Ubuntu16.04 OpenCV3.2.0
安装opencv依赖包
sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-devsudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-devsudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-devsudo apt-get install libxvidcore-dev libx264-dev sudo apt-get install libatlas-base-dev gfortran sudo apt-get install ffmpeg
下载opencv
wget
https://github.com/opencv/opencv_contrib/archive/3.2.0.zip网速太慢的话,可以用下载器试试。 解压得到opencv-3.2.0cd opencv-3.2.0mkdir buildcd build
cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..makesudo make install添加库路径 vi /etc/ld.so.conf.d/opencv.conf输入/usr/local/lib 保存环境变量
vi /etc/profile
在末尾加入:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
source /etc/profile
vi /etc/bash.bashrc
在末尾加入:
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
source /etc/bash.bashrc
sudo ldconfig
查看版本信息。检查是否安装成功。pkg-config --modversion opencv