include nonfree openCV 2.4.10 on ubuntu
Asked Answered
C

3

11

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.

Cypriot answered 15/12, 2014 at 10:21 Comment(7)
Have you tried using #include <opencv2/nonfree/features2d.hpp> (use < > instead of " ")Azole
I tried them both and got same error.Cypriot
Run make with `VERBOSE=1" and check whether the right directory is passed.Azole
You should find the path in the command invoking the compiler after a -I. If the path after the -I together with opencv2/nonfree/features2d.hpp is a valid header, it should work. If this is not the case, copy the part invoking the compiler and add the right -I with the path. If that works, try to add the include path in your CMake appropriately.Azole
please replace the unreadable image with textImmolation
@Azole actually I did not understand exactly what you mean. Can u please clarify?Cypriot
if you installed opencv via some ppm, they might have removed the 'nonfree' module. you probably have to build from github src then.Immolation
C
42

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
Cypriot answered 15/12, 2014 at 21:37 Comment(4)
The repository doesn't exist any more: Failed to fetch http://ppa.launchpad.net/xqms/opencv-nonfree/ubuntu/dists/vivid/main/binary-amd64/Packages 404 Not Found.Sinfonia
Still works for m2. AxeEffect please confirm or remove your commentEthnogeny
@PauloNeves Repository doesn't exist anymore. Doesn't work for meMotivation
This repository working on Ubuntu 16, but not on Ubuntu 14Incredulity
I
10

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.

Isagoge answered 28/6, 2015 at 8:53 Comment(1)
How to link program to -lopencv_nonfree?Meggy
S
0

This worked for me:

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

Here's where I found it:

https://askubuntu.com/a/1141214/689474

Sinistrality answered 13/1, 2020 at 7:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.