Ask Your Question
0

Fisheye has been not declared in this scope error

asked 2016-06-01 01:26:33 -0500

suraj_ch77 gravatar image

updated 2016-06-01 03:36:53 -0500

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;
}

Error: Fisheye is not a namespace name

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

edit retag flag offensive close merge delete

Comments

please replace the unreadable screenshot with a text version

berak gravatar imageberak ( 2016-06-01 01:32:16 -0500 )edit

try either:

using namespace cv::fisheye;

or:

cv::fisheye::undistortImage(...)

which opencv version is this ?

berak gravatar imageberak ( 2016-06-01 03:57:31 -0500 )edit

I am guessing that he is dealing with an old version that doesn't contain the fisheye calibration yet.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-06-01 05:39:50 -0500 )edit

I tried both of them but none of them worked. And I am using opencv 2.4.9

suraj_ch77 gravatar imagesuraj_ch77 ( 2016-06-01 23:29:31 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-06-02 02:22:12 -0500

2.4.9 is outdated and simply does not has this code included. Switch at least to 2.4.13 to have it available.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2016-06-01 01:26:33 -0500

Seen: 444 times

Last updated: Jun 02 '16