OpenCV Question

I am learning but not a Linux expert… I installed the pre-built OpenCV libraries according to the instructions on the wiki page. When I try to compile a sample, I get an error:
opencv2/core/utility.hpp: No such file or directory

The file exists in /usr/include/opencv2/gpu/device/utility.hpp. Is there a set of examples specifically for this version of opencv or do the standard samples need to be edited before they can be compiled?



Can you post the compile line code for us?

I assume that you just forgot to add the include and the library path to the compiler.

I have tried the following:

g++ edge.cpp -lopencv_core -lopencv_imgproc -lopencv_highgui -o edge

g++ edge.cpp -I/usr/include -L/usr/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -o edge

g++ edge.cpp -l/usr/include -L/use/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -o edge

With the same result…

opencv2/core/utility.hpp: No such file or directory/device

utility.hpp actually exists in opencv2/gpu/device. Should utility.hpp also exist in opencv2/core?

With the prebuilt libraries, do I also need the standard OpenCV 2.4.9?



No, you don’t need the standard opencv lib when you got the prebuild.
Unless you need the non-free stuff.

Anyways, you might need to modify your code a bit. Or symlink it

utility.hpp exist in /usr/include/opencv2/gpu/device/utility.hpp.
Doesn’t exist anywhere else.

I checked both the standard and prebuilt.

Ok… I discovered my problem… I was using the wrong samples. I found another link to OpenCV2.4.9 on sourceforge and the CPP example works based on the instructions on the wiki page.

I then went on to try the houghlines GPU example, but this fails stating that it cannot find opencv_nonfree which I cannot locate either.

Does this library need to come from somewhere else?


Pretty much you have to manually recompile the entire library to enable that portion.

Unfortunately, you are going to get a performance hit as you lost some of the optimization they made on the prebuilt.

It looks like the opencv_nonfree is no longer included with opencv. For the skilled (I am not one of them) it looks like it can be compiled and added from the source.

The houghlines example on the wiki page does not need opencv_nonfree and since it is no longer included, someone may want to modify it.