Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

include nonfree openCV 2.4.10 on ubuntu

I've installed OpenCV on ubuntu using this link and I'm trying to use SURF descriptor. I knew that they changed the location of these type of descriptors to the nonfree module so we need to include it, which is something like this: #include "opencv2/nonfree/features2d.hpp". The problem is that I'm getting this error at compile time: opencv2/nonfree/features2d.hpp no such file or directory.

Any idea how to fix it?

EDITED: The other parts of openCV are working fine. I'm including the following libraries and everything is looking good:

#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/legacy/legacy.hpp"

I checked the inlcude folder in my OpenCV directory and the nonfree folder is there. Moreover, it's the only library that I can't access within QTCreator (The environment I'm using) because I tried to include all the other librairies found in the Inlcude folder and they looked good.

EDITED2: You can see a screenshot of what I saw when I ran make VERBOSE=1 on this link

So not sure where to look? Actually, I did not find the nonfree folder in ../usr/include/opencv2/

Thanks.

like image 580
Maystro Avatar asked Dec 15 '14 10:12

Maystro


2 Answers

Actually, I just updated openCV using the following commands then it worked:

sudo add-apt-repository --yes ppa:xqms/opencv-nonfree
sudo apt-get update 
sudo apt-get install libopencv-nonfree-dev
like image 60
Maystro Avatar answered Oct 21 '22 16:10

Maystro


sudo add-apt-repository --yes ppa:xqms/opencv-nonfree
sudo apt-get update
sudo apt-get install libopencv-nonfree-dev

---this answer works well for me, thanks @Maystro

after this step, just link your program to -lopencv_nonfree, or you cannot access to surf.

like image 20
Xiongmin LIN Avatar answered Oct 21 '22 15:10

Xiongmin LIN