安装OpenCV
准备工作
$ 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
下载OpenCV
$ # Download opencv from github
$ git clone https://github.com/opencv/opencv.git
$ cd opencv
$ # 切换到想要的版本
$ git checkout 3.0.0 # OR git checkout 2.4.13
编译OpenCV
$ mkdir release
$ cd release
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local ..
$ make -j16
$ sudo make install
如果不想编译某个模块,将模块设置为OFF,例如
$ cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_DOCS=ON -D WITH_CUDA=OFF -D BUILD_DOCS=OFF ..
原文链接:https://www.f2er.com/ubuntu/354870.html