About Install Opencv3.2 in Ubuntu14.04.5LTS -VM12_Pro

 ---Ubuntu14.04.5LTSOpencv3.2的安装

/********************************

虚拟机:VM_12_Pro

安装环境:Ubuntu 14.04.5 LTS

安装版本:opencv3.2.0(官网下载)

*********************************/

开发过程中遇到了很多问题,各种博客阅读才得以帮着我安装顺利,下面做些搭建记录,希望能帮到遇到的困难的读者。

安装步骤:

Step1:安装gcc/g++/gdb/make 等基本编程工具

sudo apt-get install update
sudo apt-get install build-essential

Step2:安装opencv所依赖的库、cmake和相关插件,主要是为了能够支持读写图片以及视频等。

sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev

Step3:库安装

sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev

Step4:获取目前最新版本opencv3.2

$ sudo mkdir ~/opencv/tools -p
$ cd ~/opencv/tools
$ wget https://github.com/opencv/opencv/archive/3.2.0.zip
$ unzip 3.2.0.zip
$ mv 3.2.0.zip opencv3.2.0.zip
$ wget https://github.com/opencv/opencv_contrib/archive/3.2.0.zip
$ unzip 3.2.0.zip $ mv 3.2.0.zip opencv_contrib3.2.0.zip

或者到官网下载opencv3.2.0.zip

mkdir /opencv/
cd /opencv
unzip opencv3.2.0.zip    //默认解压到当前目录

Step5:创建目录build

cd opencv-3.2.0	//进入解压完的目录
mkdir build	//创建目录
cd build

Step6:执行cmake生成Makefile文件:

sudo cmake -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D OPENCV_EXTRA_MODULES_PATH=~/opencv/opencv_contrib-3.2.0/modules -D WITH_QT=ON -D WITH_OPENGL=ON -D CMAKE_BUILD_TYPE=RELEASE ..

Step7编译并安装

sudo make
sudo make install

Step8:配置环境

1.配置lib,巧如以下命令,在opencv.conf文件中添加/usr/local/lib

sudo gedit /etc/ld.so.conf.d/opencv.conf	//打开并创建
sudo ldconfig


2.配置bash.bashrc

打开vi /etc/bash.bashrc最后添加PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH

vi /etc/bash.bashrc

保存退出。。。。

 

Step9:测试自带的例子

cd /opencv/opencv-3.2.0/samples/cpp/example_cmake
make   //已经存在Makefile直接执行,否则cmake
./opencv_example

就会弹出Hello OpenCv咯。。。。恭喜你安装完成,去编程吧!

 

相关论坛:

OpenCV官方教程中文版  http://www.linuxidc.com/Linux/2015-08/121400.htm

参考博客:

http://blog.csdn.net/obsession2015/article/details/56665884

http://www.linuxidc.com/Linux/2014-12/110045.htm

http://blog.csdn.net/fengyhack/article/details/39002029


你可能感兴趣的:(opencv,Opencv)