21
votes

I have built the openCV 3.0 alpha version from source with support for CUDA and TBB. Now, I want to do feature detection and feature matching using SURF algorithm. SurfFeatureDetector is present in the include file

opencv2/nonfree/features2d.hpp & opencv2/nonfree/features2d.hpp

But the module nonfree is missing in this version of openCV. I tried checking the opencv forums at answers.opencv.org but the site is under construction.

How to use the non free modules?

2
Seems to be a duplicate of stackoverflow.com/questions/25549602/… (though with their page being down it won't help much - maybe those people can explain what they did?)Gregor Petrin
afaik non_free module has to be chosen explicitly during building. So if you used CMake, there might be a flag you missed?Micka
@GregorPetrin- So what should I do? Do you happen to read the solution at linkChaitanya Uttarwar
@Micka- I used the Cmake-gui. Where in the Cmake gui should I explicitly choose the non free module? Thanks.Chaitanya Uttarwar
for opencv 249 there is a BUILD_opencv_nonfree checkbox in CMake GUIMicka

2 Answers

24
votes

with opencv3.0, SURF/SIFT and some other things have been moved to a seperate opencv_contrib repo .

you will have to download that, add it to your main opencv cmake settings (please look at the readme there), and rerun cmake/make.

then:

#include "opencv2/xfeatures2d.hpp"

...
Ptr<SIFT> sift = cv::xfeatures2d::SIFT::create(...);
sift->detect(...);
0
votes

You could also install all the non-free stuff from this PPA

sudo add-apt-repository ppa:ignaciovizzo/opencv3-nonfree
sudo apt-get update
sudo apt install libopencv-dev