准备工作,Ubuntu下安装Eclipse和CDT。在这里就不说了,参考 http://www.linuxidc.com/Linux/2011-01/31367.htm 。
下面主要说一下集成OpenCV
1:安装OpenCV 可以看OpenCv的安装 http://www.linuxidc.com/Linux/2012-12/75641.htm 默认的安装目录是/usr/local/include
2:新建一个C++项目。首先右键点击新建的项目,在项目属性的C++ Build->Settings,这里要对编译器参数进行设置。在GCC C++ Compiler->Directories的include paths中新增一个/usr/local/include/opencv;和/usr/local/include/opencv2
3:终端输入
pkg-config –libs opencv
我的显示如下
/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_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
这样就意味着:
找到 GCC C++ Linker,在右侧 First in Library search path (-L) 中加入这些库
注意:
在eclipse中添加库时,usr/local/lib中是libopencv_***,在eclipse里添加为opencv_***,大小写敏感。