检查库并在opencv中编译

时间:2012-12-04 13:17:49

标签: c++ opencv

我输入此命令来检查opencv中安装了哪些库,

pkg-config --libs opencv

我得到了以下输出:

/usr/local/lib/libopencv_calib3d.so
/usr/local/lib/libopencv_contrib.s
/usr/local/lib/libopencv_feature2d.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_photo.so
/usr/local/lib/libopencv_stitching.so
/usr/local/lib/libopencv_ts.so
/usr/local/lib/libopencv_video.so
/usr/local/lib/libopencv_videostab.so

为了编译从文件中读取视频的文件,我应该给出的appropraite命令是什么?

我尝试过使用g++ -I/usr/include/opencv -lxcore -lhighgui -lm nameoffile.cpp 但我一直收到错误/usr/lib/ld cannot find -lxcore etc...

1 个答案:

答案 0 :(得分:1)

您可以尝试使用pkg-config --cflags --libs libname 然后你可以写这样的东西

g++ -I/usr/include/opencv -lxcore -lhighgui -lm nameoffile.cpp `pkg-config --cflags --libs opencv`

通过这种方式,您可以包含要链接的嘴唇的路径