Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install OpenCV 3.0 with nonfree module?

Tags:

opencv

I've tried a few times but most guides out there only tell you how to install it AFTER you've built OpenCV. I've had 2 unsuccessful attempts doing it this way and it's been a lot of work to do it this way, so

  1. I'd appreciate (and other people reading later might appreciate) basic instructions on how to install it (assuming dependencies are already there).
  2. Is it best to use git or build it yourself?
  3. What instructions must cmake be run with?
  4. Is it better to just build an old version (say 2.4.9) since version 3 is unreliable so far?
like image 325
Chandler Squires Avatar asked Jan 14 '16 04:01

Chandler Squires


1 Answers

There is an answer by Berak on the opencv forums to this question, quoted below. Essentially you can pull it down from Git, add it during the cmake process and you are good to go.

Beraks answer:

in 3.0, SIFT and SURF were moved to the opencv_contrib repo

you will need to clone/fork/download that, and add that to your (main opencv) cmake;

cmake -DOPENCV_EXTRA_MODULES_PATH=<opencv_contrib>/modules

then, after building,

#include "opencv2/xfeatures2d/nonfree.hpp"

Ptr<xfeatures2d::SURF> surf = xfeatures2d::SURF::create(); // note
extra namespace surf->detect(...); surf->compute(...);

don't forget to link to opencv_xfeatures2d(.lib)

Also, in answer to Question #4. OpenCV 3.0 is fine, I wouldn't say it was unreliable.

like image 138
GPPK Avatar answered Oct 23 '22 10:10

GPPK