【安装教程】opencv3.2 contrib ubuntu16.04

安装包下载

-安装包请按照版本对应

安装依赖

$ sudo apt-get install build-essential
$ sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
$ sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev # 处理图像所需的包
$ sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev
$ sudo apt-get install libxvidcore-dev libx264-dev # 处理视频所需的包
$ sudo apt-get install libatlas-base-dev gfortran # 优化opencv功能
$ sudo apt-get install ffmpeg 

将opencv-contrib解压到opencv-3.2.0文件夹中,并且在opencv3.2.0文件夹中新建release文件夹

安装ccmake

sudo apt-get install cmake-curses-gui

然后切换到release目录下

ccmake ..

注意设置几个参数, OPENCV_EXTRA_MODULES_PATH设置为opencv-contrib/moduls的绝对路径。

-其他参数按照自己需要选择

-支持qt on

sudo apt-get install qt5-default

编译参数设置好后,按c,按g,返回命令行,执行

cmake ..
make -j8
sudo make install

配置opencv.conf,将opencv加入环境变量:

sudo gedit /etc/ld.so.conf.d/opencv.conf

写入/usr/local/lib

更新库目录

sudo ldconfig

打开文件bash.bashrc

sudo gedit /etc/bash.bashrc

加入下面两行

PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

你可能感兴趣的:(【安装教程】opencv3.2 contrib ubuntu16.04)