p { margin-bottom: 0.25cm; direction: ltr; color: rgb(0, 0, 0); line-height: 120% }
p.western { font-family: "Liberation Serif", "Times New Roman", serif; font-size: 12pt }
p.cjk { font-family: "Noto Sans CJK SC Regular"; font-size: 12pt }
p.ctl { font-family: "Noto Sans CJK SC Regular"; font-size: 12pt }
a:link { }
Ubuntu 安装opencv3.x 以3.2为例
1.安装需要的包:
$ 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
如果装完了还担心是否安装成功的话,可以这样查看是否安装成功:
$ dpkg --listfiles cmake
$ dpkg –listfiles git
$ dpkg –listfiles ……
2.下载opencv-3.0.0.zip( opencv官网下载http://opencv.org/)
解压安装包(博主放在了主文件下),进入解压后的文件夹:
$ unzip opencv-3.0.0.zip
$ cd opencv-3.0.0
3. 新建build文件夹存放opencv的编译文件,进入build文件夹:
$ mkdir build
$ cd build
4. 配置opencv文件:
$ cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local ..
5.编译和安装:
$ make -j 4
$ sudo make install
至此OpenCV就可以使用了
6.配置
1)
$ sudo gedit /etc/ld.so.conf.d/opencv.conf
打开的文档中添加:/usr/local/lib,保存退出
$ sudo ldconfig
2)
$ sudo gedit /etc/bash.bashrc
打开的文档中添加:
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
保存退出