如何在openv 2.4.9中启用findEssentialMat



我正在尝试使用OpenCV 2.4.9中的新函数findEssentialMat(),但当我试图编译我的程序时,它说findEssentialMat未定义。我包括calib3d和我也链接适当的库。

我应该如何编译OpenCV启用该功能?

这是我的程序:

# include"opencv2/opencv.hpp"

using namespace std;使用命名空间cv;

Mat getEssential(const vector<KeyPoint>& keypoints1,const vector<KeyPoint>& keypoints2,vector<DMatch>& matches){
vector<Point2f> p1, p2;
for (vector<DMatch>::const_iterator it= matches.begin();it!= matches.end(); ++it) {
    float x=keypoints1[it->queryIdx].pt.x;
    float y=keypoints1[it->queryIdx].pt.y;
    p1.push_back(Point2f(x,y));
    x=keypoints2[it->trainIdx].pt.x;
    y=keypoints2[it->trainIdx].pt.y;
    p2.push_back(Point2f(x,y));
}
Mat output;
Mat essen = findEssentialMat(p1,p2,focal,pp,CV_RANSAC,0.99,1,output);
vector<DMatch> inliers;
for(int i=0;i<output.rows;i++){
    int status=output.at<char>(i,0);
    if(status==1){
        inliers.push_back(matches[i]);
    }
}
matches=inliers;
return essen;
}
int main(){
  Ptr<FeatureDetector> fast = new FastFeatureDetector(10,true);
  Ptr<FeatureDetector> detector = new PyramidAdaptedFeatureDetector(fast,3);
  FREAK freak(true,true,22.0f,0);
  BFMatcher matcher(NORM_HAMMING,true);
  vector<DMatch> matches;
  vector<KeyPoint> kp0,kp1;
  Mat d0, d1;
  Mat im0 = imread("/home/Chini/im0.png",0);
  Mat im1 = imread("/home/Chini/im1.png",0);
  detector->detect(im0,kp0,Mat());
  detector->detect(im1,kp0,Mat());
  freak.compute(im0,kp0,d0);
  freak.compute(im1,kp1,d1);
  matcher.match(d0,d1,matches);
  Mat e = getEssential(kp0,kp1,matches);
  }

当我试图编译它时,我收到以下消息:

example.cpp: In function ‘cv::Mat getEssential(const std::vector<cv::KeyPoint>&, const    std::vector<cv::KeyPoint>&, std::vector<cv::DMatch>&)’:
example.cpp:18:62: error: ‘findEssentialMat’ is not defined

Thanks in advance

没有办法这样做

findEssentialMat()

是在3.中实现的函数。x版本

按照这里的"如何贡献OpenCV指南":http://code.opencv.org/projects/opencv/wiki/How_to_contribute2.4。X opencv版本已经被功能冻结,并且被维护只是为了提供与遗留用户的向后兼容性,用他们的话说:

"2.4已被功能冻结;因此,新功能将不被接受。"

我强烈建议你安装3。x版本。

有一些很好的教程:http://embedonix.com/articles/image-processing/installing-opencv-3-1-0-on-ubuntu/#comment-125http://rodrigoberriel.com/2014/10/installing-opencv-3-0-0-on-ubuntu-14-04/(最后一个对我有效)

相关内容

  • 没有找到相关文章

最新更新