[compiler] sudo apt-get install build-essential
[required] sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
[optional] sudo apt-get install python-dev python-numpy libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev
cd ~/
git clone https://github.com/opencv/opencv.git
git clone https://github.com/opencv/opencv_contrib.git
cd ~/opencv
复制.cache文件夹到此目录
.链接:https://pan.baidu.com/s/1As_m86Y44xLtHP4XLKzeFA 密码:9yc5
├── ./data
│ └── ./data/7505c44ca4eb54b4ab1e4777cb96ac05-face_landmark_model.dat
├── ./ippicv
│ └── ./ippicv/b7cc351267db2d34b9efa1cd22ff0572-ippicv_2017u3_lnx_intel64_general_20180518.tgz
└── ./xfeatures2d
├── ./xfeatures2d/boostdesc
│ ├── ./xfeatures2d/boostdesc/0ae0675534aa318d9668f2a179c2a052-boostdesc_lbgm.i
│ ├── ./xfeatures2d/boostdesc/0ea90e7a8f3f7876d450e4149c97c74f-boostdesc_bgm.i
│ ├── ./xfeatures2d/boostdesc/202e1b3e9fec871b04da31f7f016679f-boostdesc_binboost_064.i
│ ├── ./xfeatures2d/boostdesc/232c966b13651bd0e46a1497b0852191-boostdesc_bgm_bi.i
│ ├── ./xfeatures2d/boostdesc/324426a24fa56ad9c5b8e3e0b3e5303e-boostdesc_bgm_hd.i
│ ├── ./xfeatures2d/boostdesc/98ea99d399965c03d555cef3ea502a0b-boostdesc_binboost_128.i
│ └── ./xfeatures2d/boostdesc/e6dcfa9f647779eb1ce446a8d759b6ea-boostdesc_binboost_256.i
└── ./xfeatures2d/vgg
├── ./xfeatures2d/vgg/151805e03568c9f490a5e3a872777b75-vgg_generated_120.i
├── ./xfeatures2d/vgg/7126a5d9a8884ebca5aea5d63d677225-vgg_generated_64.i
├── ./xfeatures2d/vgg/7cd47228edec52b6d82f46511af325c5-vgg_generated_80.i
└── ./xfeatures2d/vgg/e8d0dcd54d1bcfdc29203d011a797179-vgg_generated_48.i
mkdir build
cd build
最大的麻烦就是C++11按照这个cmake进行安装
cmake -DCMAKE_BUILD_TYPE=Release -D ENABLE_PRECOMPILED_HEADERS=OFF -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules/ -D CMAKE_CXX_FLAGS=-std=c++11 -D CMAKE_INSTALL_PREFIX=/usr/local ..
make -j7
sudo make install