1.安装依赖项
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
可选的
sudo apt-get install checkinstall yasm libtiff5-dev libjpeg-dev libjasper-dev libdc1394-22-dev libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils libeigen3-dev
2.创建编译目录
1 cd opencv-3.1.0 2 mkdir release 3 cd release
3.生成cmake编译配置
这里下载文件可能会出错,解决办法就是去官网下载ippicv_linux_20151201.tgz,然后放到该路径下
/home/computer/opencv-3.1.0/3rdparty/ippicv/downloads/linux-808b791a6eac9ed78d32a7666804320e/ 没有的文件夹要新建
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
有时候会遇到玄学问题,报错,而且无从解决.有一招可解决,就是重启电脑,重新安装,然后就成功了.(亲测有效,感觉这绝对是一个玄学问题)
4.安装
sudo make install
5.安装python-opencv
sudo apt-get install python-opencv
6.测试
查看opencv版本
pkg-config --modversion opencv
参考博文
http://blog.csdn.net/u013382233/article/details/73198135
http://blog.csdn.net/u011440558/article/details/78358447