Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package opencv was not found in the pkg-config search path

I have installed OpenCV using the instructions in https://help.ubuntu.com/community/OpenCV

$ sudo su $ sudo apt-get install build-essential $ sudo apt-get install libavformat-dev $ sudo apt-get install ffmpeg $ sudo apt-get install libcv2.3 libcvaux2.3 libhighgui2.3 python-opencv opencv-doc libcv-dev libcvaux-dev libhighgui-dev 

now when i execute "pkg-config --cflags --libs opencv" i get this error:

Package opencv was not found in the pkg-config search path. Perhaps you should add the directory containing `opencv.pc' to the PKG_CONFIG_PATH environment variable No package 'opencv' found 

how can I resolve this problem?

-------UPDATE-------

OK, I figured out how to solve the problem...

I made a file named "opencv.pc" and copied it to "/usr/local/lib/pkgconfig" Then i added these two lines to ".bashrc":

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig export PKG_CONFIG_PATH 

that's it! everything is OK now.

the contents of the file are:

prefix=/usr exec_prefix=${prefix} includedir=${prefix}/include libdir=${exec_prefix}/lib  Name: opencv Description: The opencv library Version: 2.x.x Cflags: -I${includedir}/opencv -I${includedir}/opencv2 Libs: -L${libdir} -lopencv_calib3d -lopencv_imgproc -lopencv_contrib -lopencv_legacy -lopencv_core -lopencv_ml -lopencv_features2d -lopencv_objdetect -lopencv_flann -lopencv_video -lopencv_highgui 

UPDATE - 2014

it seems that the ubuntu community has completed the documentation on installing openCV, all you have to do now is to download the installation script from https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/opencv_latest.sh and execute it.

like image 349
aliep Avatar asked Mar 10 '13 08:03

aliep


People also ask

Where is pkg config search path?

On a typical Unix system, it will search in the directories /usr/lib/pkgconfig and /usr/share/pkgconfig .


1 Answers

From your question I guess you are using Ubuntu (or a derivate). If you use:

apt-file search opencv.pc

then you see that you have to install libopencv-dev.

After you do so, pkg-config --cflags opencv and pkg-config --libs opencv should work as expected.

like image 159
m4r10k Avatar answered Sep 22 '22 02:09

m4r10k