使用git下载OpenCV源码
git clone https://gitee.com/opencv/opencv.git
安装软件包
sudo apt-get install python-dev python-numpy libavcodec-dev libavformat-dev
sudo apt-get install libswscale-dev libjpeg-dev libpng-dev libtiff-dev
sudo apt-get install libfreetype6-dev ffmpeg checkinstall libavcodec-dev
sudo apt-get install libavformat-dev libavutil-dev libswscale-dev libavresample-dev
sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
sudo apt-get install liblapack-dev libeigen3-dev
然后开始编译&安装
cd opencv
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DOPENCV_DOWNLOAD_MIRROR_ID=gitcode ..
make -j8
sudo make install