sudo apt-get install build-essential libgtk2.0-dev libgtk-3-dev libavcodec-dev libavformat-dev libjpeg-dev libswscale-dev libtiff5-dev # python3支持 $ sudo apt install python3-dev python3-numpy # streamer支持 $ sudo apt install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev # 可选的依赖 $ sudo apt install libpng-dev libopenexr-dev libtiff-dev libwebp-dev
源碼下載 https://opencv.org/releases/ unzip opencv-4.2.0.zip mkdir build cd build/
編譯 cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. make sudo make install?
配置環境 sudo gedit /etc/ld.so.conf.d/opencv.conf 添加 /usr/local/lib
sudo gedit /etc/bash.bashrc 添加 PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig ? ? ? export PKG_CONFIG_PATH
source /etc/bash.bashrc sudo updatedb
在终端打开到opencv-4.1.2/sample/cpp/example_cmake目录,执行下面的代码: cmake . make ./opencv_example
|