您好,登錄后才能下訂單哦!
今天就跟大家聊聊有關Ubuntu 20.04中怎么編譯安裝OpenCV 4.3,可能很多人都不太了解,為了讓大家更加了解,小編給大家總結了以下內容,希望大家根據這篇文章可以有所收獲。
sudo apt install build-essential cmake git pkg-config libgtk-3-dev \ libavcodec-dev libavformat-dev libswscale-dev libv4l-dev \ libxvidcore-dev libx264-dev libjpeg-dev libpng-dev libtiff-dev \ gfortran openexr libatlas-base-dev python3-dev python3-numpy \ libtbb2 libtbb-dev libdc1394-22-dev libopenexr-dev \ libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \ qtbase5-dev qtdeclarative5-dev llvm clang libclang-dev
OpenCV: https://github.com/opencv/opencv/releases/tag/4.3.0
OpenCV contrib: https://github.com/opencv/opencv_contrib/releases/tag/4.3.0
1)下載地址:
https://github.com/opencv/opencv/archive/refs/tags/4.3.0.tar.gz
https://github.com/opencv/opencv_contrib/archive/refs/tags/4.3.0.tar.gz
2)解壓到目錄:/home/admin/opencv_4.3_build/
cd /home/admin/opencv_4.3_build/ tar -zxvf opencv-4.3.0.tar.gz tar -zxvf opencv_contrib-4.3.0.tar.gz
cd /home/admin/opencv_4.3_build/opencv-4.3.0/ cmake .. \ -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D WITH_TBB=ON \ -D WITH_V4L=ON \ -D WITH_QT=ON \ -D WITH_GTK=ON \ -D WITH_OPENGL=ON \ -D WITH_VTK=ON \ -D OPENCV_GENERATE_PKGCONFIG=YES \ -D INSTALL_C_EXAMPLES=ON \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_GENERATE_PKGCONFIG=ON \ -D OPENCV_ENABLE_NONFREE=ON \ -D BUILD_DOCS=ON \ -D BUILD_EXAMPLES=ON \ -D PYTHON3_EXECUTABLE=/usr/bin/python3 \ -D PYTHON_INCLUDE_DIR=/usr/include/python3.8 \ -D PYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.8.so \ -D OPENCV_EXTRA_MODULES_PATH=/home/admin/opencv_4.3_build/opencv-4.3.0/opencv_contrib-4.3.0/modules \ -D BUILD_EXAMPLES=ON
(-j后面的數字代表多線程,請根據自己的電腦配置設置,官網默認為7)
make -j12
sudo make install
pkg-config --modversion opencv4 # 輸出:4.3.0 python3 -c "import cv2; print(cv2.__version__)" # 輸出:4.3.0
看完上述內容,你們對Ubuntu 20.04中怎么編譯安裝OpenCV 4.3有進一步的了解嗎?如果還想了解更多知識或者相關內容,請關注億速云行業資訊頻道,感謝大家的支持。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。