Ask Your Question
0

OpenCV 3.0.0 beta - Use common interface with SURF

asked 2015-03-13 08:15:27 -0600

victorp gravatar image

updated 2015-03-16 03:19:40 -0600

I am trying to use the common interface to features detectors and extractors for SURF features. The documentation states that cv::SURF implements the Features2D interface, but when I try:

cv::Ptr<cv::SURF> surf = cv::SURF::create(400);

I get the compiler error:

features_analysis.cpp:134:50: error: no matching function for call to ‘cv::SURF::create(int)’

I have installed xfeatures2D from the contrib module but I am also confused about namespaces, is SURF in cv::SURF or cv::xfeatures2d::SURF ? And what is the correct header to include? The documentation is very confusing and contradictory at times.

EDIT: Is there a "beta" release of opencv_contrib? Because now I'm using opencv-3.0.0-beta with the master branch of opencv_contrib, could that be a problem?

EDIT2: Nevermind, I just found it here: https://github.com/Itseez/opencv_cont...

edit retag flag offensive close merge delete

Comments

3

cv::xfeatures2d::SURF, and #include "opencv2/xfeatures2d.hpp"

berak gravatar imageberak ( 2015-03-13 08:54:27 -0600 )edit

That include gives a fatal error: opencv2/xfeatures2d.hpp: No such file or directory. I'll check my installation of OpenCV and report back.

victorp gravatar imagevictorp ( 2015-03-16 03:09:16 -0600 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2015-03-16 04:07:42 -0600

victorp gravatar image

updated 2015-03-16 04:08:58 -0600

As pointed out in the comments by @berak the correct include and class name are cv::xfeatures2d::SURF, and #include "opencv2/xfeatures2d.hpp". So use for example:

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

I believe my installation had problems because I was using opencv-3.0.0-beta with opencv_contrib (master branch). Recompiling and installing opencv-3.0.0-beta with opencv_contrib-3.0.0-beta seems to have resolved the issue.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-03-13 08:15:27 -0600

Seen: 1,210 times

Last updated: Mar 16 '15