0.安装依赖项
sudo apt-get install build-essential libgtk2.0-dev libavcodec-dev libavformat-dev libjpeg-dev
sudo apt-get install libtiff5-dev libswscale-dev
sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main"
sudo apt update
sudo apt install libjasper1 libjasper-dev
1.安装OpenCV3.4
cd opencv-3.4.5
mkdir build
cd build
cmake ..
make
sudo make install
2.配置环境变量
sudo vim /etc/ld.so.conf.d/opencv.conf
sudo ldconfig
3.配置.bashrc
sudo vim /etc/bash.bashrc
PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
export PKG_CONFIG_PATH
4.source与update
source /etc/bash.bashrc
sudo updatedb
5.测试安装是否成功
cd ./opencv-3.4.5/samples/cpp/example_cmake
mkdir build
cd build
cmake ..
make
./opencv_example
|