Created
August 13, 2020 00:59
-
-
Save alien18331/5c60172162627fb295ebae75ac141cc6 to your computer and use it in GitHub Desktop.
[ubuntu18] opencv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt update | |
$ sudo apt install python3-opencv | |
$ sudo apt install build-essential cmake git pkg-config libgtk-3-dev | |
$ sudo apt install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev libxvidcore-dev libx264-dev | |
$ sudo apt install libjpeg-dev libpng-dev libtiff-dev gfortran openexr libatlas-base-dev | |
$ sudo apt install python3-dev python3-numpy libtbb2 libtbb-dev libdc1394-22-de | |
$ mkdir ~/opencv_build && cd ~/opencv_build | |
$ git clone https://github.com/opencv/opencv.git | |
$ git clone https://github.com/opencv/opencv_contrib.git | |
如果要安装旧版本的OpenCV,请在opencv和opencv_contrib目录运行git checkout <opencv-version> | |
ex. git checkout 3.4.4 | |
copy opencv_contrib to opencv folder, and then cmake | |
$ cmake -D CMAKE_BUILD_TYPE=RELEASE \ | |
-D CMAKE_INSTALL_PREFIX=/usr/local \ | |
-D INSTALL_C_EXAMPLES=ON \ | |
-D INSTALL_PYTHON_EXAMPLES=ON \ | |
-D OPENCV_GENERATE_PKGCONFIG=ON \ | |
-D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib/modules \ | |
-D BUILD_EXAMPLES=ON .. | |
$ make -j8 | |
$ sudo make install | |
check version of opencv | |
$ pkg-config --modversion opencv or pkg-config --modversion opencv4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment