Closed ghost closed 9 years ago
I don't understand why you have libXext libX11 libICE libSM libGL libGLU
in the mex arguments. Can you post the output of !pkg-config --cflags --libs opencv
within matlab?
@zhuangbohan:
Are you sure you edited the correct opencv.pc
file, not some template one in the source tree?
You want the one that pkg-config
will find (either in its default search path like /usr/lib/x86_64-linux-gnu/pkgconfig/opencv.pc
or manually specified by PKG_CONFIG_PATH
).
@kyamagu @amroamroamro the output is
-I/usr/local/include/opencv -I/usr/local/include /usr/local/lib/libopencv_calib3d.so /usr/local/lib/libopencv_contrib.so /usr/local/lib/libopencv_core.so /usr/local/lib/libopencv_features2d.so /usr/local/lib/libopencv_flann.so /usr/local/lib/libopencv_gpu.so /usr/local/lib/libopencv_highgui.so /usr/local/lib/libopencv_imgproc.so /usr/local/lib/libopencv_legacy.so /usr/local/lib/libopencv_ml.so /usr/local/lib/libopencv_nonfree.so /usr/local/lib/libopencv_objdetect.so /usr/local/lib/libopencv_ocl.so /usr/local/lib/libopencv_photo.so /usr/local/lib/libopencv_stitching.so /usr/local/lib/libopencv_superres.so /usr/local/lib/libopencv_ts.a /usr/local/lib/libopencv_video.so /usr/local/lib/libopencv_videostab.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libGL.so /usr/lib/x86_64-linux-gnu/libGLU.so -ltbb -lrt -lpthread -lm -ldl
But I have already modified the /usr/lib/x86_64-linux-gnu/pkgconfig/opencv.pc
as:
prefix=/usr
exec_prefix=${prefix}
libdir=${prefix}/lib/x86_64-linux-gnu
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include
Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.8
Libs: -L${exec_prefix}/lib -L/usr/lib/x86_64-linux-gnu -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_ocl -lopencv_photo -lopencv_stitching -lopencv_superres -lopencv_ts -lopencv_video -lopencv_videostab -lopencv_viz -ltbb -lXext -lX11 -lICE -lSM -lGL -lGLU -lrt -lpthread -lm -ldl
Cflags: -I${includedir_old} -I${includedir_new}
I don't know why the output of pkg-config doesn't change!!
@zhuangbohan
According to your output, you have another instance of OpenCV installed in /usr/local
in addition to the packaged one at /usr/
. Try to find opencv.pc
under /usr/local/lib
. Also make sure that your mexopencv is up-to-date.
@zhuangbohan:
kyamagu is right, you have a locally installed OpenCV version that is picked up by pkg-config
before the one installed system-wide by the package manager.
You can get a list of paths that pkg-config
searches by default using:
$ pkg-config --variable pc_path pkg-config
/usr/local/lib/x86_64-linux-gnu/pkgconfig:/usr/local/lib/pkgconfig:/usr/local/share/pkgconfig:/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
As you can see, /usr/local/lib/..
comes before /usr/lib/..
in the search order.
Therefore, in your case you should explicitly set the one you want:
$ export PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig
$ pkg-config --libs opencv
@kyamagu @amroamroamro Thanks a lot !! It now works!! But how can I delete the redundant one?
@zhuangbohan
just remove the one under /usr/local/..
if you dont need that version!
You'll want to delete the header files /usr/local/include/opencv
, the libs /usr/local/lib/libopencv_*
and the opencv.pc
file somewhere under /usr/local/lib
...
If you still have the source makefile you used to build this version, you can just cd
into that directory and run make uninstall
.
That way you'll end up with just OpenCV installed by apt-get
.
@amroamroamro
Thanks, I really learnt a lot!!
I modified the
opencv.pc
file asBut the error now is as follow:
I'm not sure how to solve this problem. HELP!!!