Ask Your Question
0

OpenCV 3.0.0 beta - Use common interface with SURF

asked Mar 13 '15

victorp gravatar image

updated Mar 16 '15

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...

Preview: (hide)

Comments

3

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

berak gravatar imageberak (Mar 13 '15)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 (Mar 16 '15)edit

1 answer

Sort by » oldest newest most voted
1

answered Mar 16 '15

victorp gravatar image

updated Mar 16 '15

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.

Preview: (hide)

Question Tools

1 follower

Stats

Asked: Mar 13 '15

Seen: 1,270 times

Last updated: Mar 16 '15