4

I need to find and match feature points in stereo images. Therefore I want to compare the different Feature Detection algorithms that are supported in OpenCV 2.4.5. by passing "SURF", "SIFT", etc. to the function.

The code snippet:

#include "opencv2/opencv.hpp"
#include <opencv/highgui.h>
#include <opencv2/nonfree/features2d.hpp>

using namespace cv;
using namespace std;

...

void DisparityAnalysis::detectKeyPoints(Mat1b leftImageGrey, Mat1b rightImageGrey, string algorithmName)
{
    Ptr<FeatureDetector> detector = FeatureDetector::create(algorithmName);
    detector->detect(leftImageGrey, keypoints_1);
    detector->detect(rightImageGrey, keypoints_2);
}

The error:

Unhandled exception at 0x770b15de in DisparityAnalysis.exe: 0xC0000005: Access violation reading location 0x00000000.

I've already searched for solutions and found this one: Access violation reading in FeatureDetector OpenCV 2.4.5 The difference I've recognized is, that they use cv::initModule_nonfree() at the beginning. But when copying it into my code it doesn't compile because the identifier isn't found. Any suggestions?

Community
  • 1
  • 1
filla2003
  • 724
  • 1
  • 8
  • 18

1 Answers1

3

for SIFT and SURF, you'll need the nonfree module, that is :

  • include "opencv2/nonfree/nonfree.hpp"

  • call cv::initModule_nonfree() at the beginning

  • link against opencv_nonfree2.4.x.lib

berak
  • 39,159
  • 9
  • 91
  • 89
  • thanks @berak, because "opencv2/nonfree/nonfree.hpp" was missing, cv::initModule_nonfree() gave an error – filla2003 Jul 22 '13 at 10:41