Ask Your Question
0

SURF identifier not defined

asked 2018-07-16 06:01:00 -0600

dursunsefa gravatar image

I set up the Opencv_contrib module properly with Cmake (On Visual Studio ). However, when I use the SurfFeatureDetector identifier, I get the following error: 'SURF identifier not defined'.

Part of it code :

Mat image1 = imread("...);

if (!image1.data)
{
    cout << " --(!) Error reading images " << endl;
    return -1;
}


int minHessian = 400;
SurfFeatureDetector detector(minHessian);
std::vector<KeyPoint> keypoints_1;
detector.detect(image1, keypoints_1);

... header files are as follows :

include "opencv2/core/core.hpp"

include "opencv2/highgui/highgui.hpp"

include "opencv2/xfeatures2d/nonfree.hpp"

include "opencv2/features2d/features2d.hpp"

include "opencv2/xfeatures2d.hpp"

Are there any ones that can help solve the problem? ( I am using the Opencv 3.2.0 version.) Thanks , good works.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2018-07-16 06:59:03 -0600

berak gravatar image

you're trying with outdated 2.4 code, the api has changed since 3.x.

please use:

Ptr<xfeatures2d::SURF> surf = xfeatures2d::SURF::create();

std::vector<KeyPoint> keypoints;
Mat descriptors;

surf->detectAndCompute(img, Mat(), keypoints, descriptors);

please also have a look at current tutorials

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-07-16 06:01:00 -0600

Seen: 685 times

Last updated: Jul 16 '18