21

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?

Chaitanya Uttarwar
  • 318
  • 2
  • 6
  • 13
  • Seems to be a duplicate of http://stackoverflow.com/questions/25549602/nonfree-package-missing-opencv-3-0-alpha (though with their page being down it won't help much - maybe those people can explain what they did?) – Gregor Petrin Dec 11 '14 at 08:55
  • afaik non_free module has to be chosen explicitly during building. So if you used CMake, there might be a flag you missed? – Micka Dec 11 '14 at 09:04
  • @GregorPetrin- So what should I do? Do you happen to read the solution at [link](http://answers.opencv.org/question/40510/30-alpha-missing-nonfree-package/) – Chaitanya Uttarwar Dec 11 '14 at 09:10
  • @Micka- I used the Cmake-gui. Where in the Cmake gui should I explicitly choose the non free module? Thanks. – Chaitanya Uttarwar Dec 11 '14 at 09:11
  • for opencv 249 there is a BUILD_opencv_nonfree checkbox in CMake GUI – Micka Dec 11 '14 at 09:13

2 Answers2

24

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(...);
berak
  • 39,159
  • 9
  • 91
  • 89
  • 1
    Thanks berak. I am following your suggested method. I have extracted the opencv_contrib-master in the opencv source folder. I am about to configure using Cmake(GUI), So I wanted to ask if there are any special flags in Cmake so that the build is built with the contrib modules? – Chaitanya Uttarwar Dec 11 '14 at 10:59
0

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