sudo apt-get install build-essential cmake git pkg-config
sudo apt-get install libjpeg8-dev
sudo apt-get install libtiff5-dev
sudo apt-get install libjasper-dev
sudo apt-get install libpng12-dev
sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get install libgtk2.0-dev
sudo apt-get install libatlas-base-dev gfortran
git clone https://github.com/opencv/opencv.git
// 根据下载的版本而定
cd opencv-3.2.0
// 创建release文件夹
mkdir release
// 进入release目录下
cd release
// cmake读入所有源文件之后,自动生成makefile
cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local ..
// 编译
sudo make
// 安装
sudo make install
//更新动态链接库
sudo ldconfig