Ask Your Question

Revision history [back]

Fisheye has been not declared in this scope error

I am trying to call cv::fisheye::undistortImage for removing distortion from image but in the compilation time its showing fisheye not declared in this scope . How to resolve this error?

#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "opencv2/calib3d/calib3d.hpp"

using namespace std;
using namespace cv;
using namespace fisheye;

int main (int argc, const char * argv[]){

    Mat img;
    img = imread(argv[1]);   // Read the file
    Mat new_image;
    /// creating cameramatrix
    Mat cameraMatrix = Mat::zeros(3, 3, CV_64F);
    Mat distCoeff = Mat::zeros(1, 8, CV_64F);
    distCoeff.at<double>(0,0) = -0.3682;
    distCoeff.at<double>(0,1) = 0.2848;

    cameraMatrix.at<double>(0, 0) = 611.18; /* 0*/                               
    cameraMatrix.at<double>(0, 2) = 515.31;
    /*0*/                                
    cameraMatrix.at<double>(1, 1) = 611.06; 
    cameraMatrix.at<double>(1, 2) = 402.07;  
    /*0*/                                /*0*/                                
    cameraMatrix.at<double>(2, 2) = 1;

    Mat newCameraMatrix;
    cameraMatrix.copyTo(newCameraMatrix);

    fisheye::undistortImage(img, new_image, cameraMatrix, distCoeff, newCameraMatrix);
    cout << cameraMatrix << endl << endl;


    imshow("new_image", new_image);
    waitKey(0);

    return 0;
}

image description

Fisheye has been not declared in this scope error

I am trying to call cv::fisheye::undistortImage for removing distortion from image but in the compilation time its showing fisheye not declared in this scope . How to resolve this error?

#include <iostream>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "opencv2/calib3d/calib3d.hpp"

using namespace std;
using namespace cv;
using namespace fisheye;

int main (int argc, const char * argv[]){

    Mat img;
    img = imread(argv[1]);   // Read the file
    Mat new_image;
    /// creating cameramatrix
    Mat cameraMatrix = Mat::zeros(3, 3, CV_64F);
    Mat distCoeff = Mat::zeros(1, 8, CV_64F);
    distCoeff.at<double>(0,0) = -0.3682;
    distCoeff.at<double>(0,1) = 0.2848;

    cameraMatrix.at<double>(0, 0) = 611.18; /* 0*/                               
    cameraMatrix.at<double>(0, 2) = 515.31;
    /*0*/                                
    cameraMatrix.at<double>(1, 1) = 611.06; 
    cameraMatrix.at<double>(1, 2) = 402.07;  
    /*0*/                                /*0*/                                
    cameraMatrix.at<double>(2, 2) = 1;

    Mat newCameraMatrix;
    cameraMatrix.copyTo(newCameraMatrix);

    fisheye::undistortImage(img, new_image, cameraMatrix, distCoeff, newCameraMatrix);
    cout << cameraMatrix << endl << endl;


    imshow("new_image", new_image);
    waitKey(0);

    return 0;
}

image descriptionError: Fisheye is not a namespace name

Error in main: Fisheye has not been declared in this scope