Reference:
http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html
http://docs.opencv.org/3.0-beta/doc/tutorials/introduction/linux_install/linux_install.html
1.安装需要的packages
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
2.下载Opencv源代码安装包并解压(假设解压后的文件夹名为opencv)
https://sourceforge.net/projects/opencvlibrary/
3.进入目录building源代码
cd ~/opencv mkdir release cd release cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
4.make
make -j8 # -j8 runs 8 jobs in parallel. # Change 8 to number of hardware threads available. sudo make install原文链接:https://www.f2er.com/ubuntu/351247.html