红联Linux门户
Linux帮助

ubuntu15.10 opencv3.1安装配置codeblocks

发布时间:2016-03-12 09:50:39来源:linux网站作者:研究计算机视觉的三流

安装codeblocks:

sudo add-apt-repository ppa:damien-moore/codeblocks-stable  // 添加codeblocks的ppa
sudo  apt-get update
sudo install codeblocks


配置codeblocks使用opencv3

1、首先执行下面两条命令,查看本机的Include paths 和 Library search path:

pkg-config --cflags opencv
/*显示内容
-I/usr/local/include/opencv -I/usr/local/include     / 引入的头文件的地址
*/

pkg-config --libs opencv
/*显示内容
-L/usr/local/lib -lopencv_stitching -lopencv_superres -lopencv_videostab -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib       / 各种opencv的链接库的地址
-lopencv_dnn -lopencv_dpm -lopencv_fuzzy -lopencv_line_descriptor -lopencv_optflow -lopencv_plot -lopencv_reg -lopencv_saliency -lopencv_stereo
-lopencv_structured_light -lopencv_rgbd -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_face -lopencv_xfeatures2d
-lopencv_shape -lopencv_video -lopencv_ximgproc -lopencv_calib3d -lopencv_features2d -lopencv_flann -lopencv_xobjdetect -lopencv_objdetect -lopencv_ml
-lopencv_xphoto -lippicv -lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_photo -lopencv_imgproc -lopencv_core
*/


2、然后打开codeblocks: setting->complier->Linker settings

把/usr/local/lib下的所有.so文件全部加入到Link libraries中。

ubuntu15.10 opencv3.1安装配置codeblocks


3、添加Search Directories -> Complier 的内容。

加入两个路径: /usr/local/include/opencv  和 /usr/local/include/opencv2

ubuntu15.10 opencv3.1安装配置codeblocks


4、添加Search Directories ->Linker 的内容。

把/usr/local/lib 添加进去。

ubuntu15.10 opencv3.1安装配置codeblocks


最后,在codeblock建一个opencv的项目,他会直接生成一个显示lena图的程序,直接运行即可。

ubuntu15.10 opencv3.1安装配置codeblocks

ubuntu15.10 opencv3.1安装配置codeblocks


本文永久更新地址:http://www.linuxdiyf.com/linux/18844.html