Picture.png
python version installation
$ sudo pip install opencv-python $ sudo pip install opencv-contrib-python
C++ installation
Install OpenCV dependency
$ sudo apt-get update $ sudo apt-get upgrade # development tool $ sudo apt-get install build-essential cmake unzip pkg-config # Graphics library $ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev # Video library $ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev $ sudo apt-get install libxvidcore-dev libx264-dev # GTK $ sudo apt-get install libgtk-3-dev # Other $ sudo apt-get install libatlas-base-dev gfortran # python header file $ sudo apt-get install python3-dev
download
$ cd ~ $ wget -O opencv.zip https://github.com/opencv/opencv/archive/3.4.1.zip $ wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/3.4.1.zip $ unzip opencv.zip $ unzip opencv_contrib.zip
Official installation documents
Picture.png
The latest version number can be seen next to "OpenCV" in the upper right corner of the image above. If you want to use opencv3.4.3, modify https://github.com/opencv/opencv/archive/3.4.1.zip by https://github.com/opencv/opencv/archive/3.4.3.zip Yes.
install
$ cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.0/modules -DOPENCV_ENABLE_NONFREE=True $ sudo make install $ export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH $ sudo ldconfig
2.4.13 ubuntu 14.04
# install dependencies sudo apt-get update sudo apt-get install -y build-essential sudo apt-get install -y cmake sudo apt-get install -y libgtk2.0-dev sudo apt-get install -y pkg-config sudo apt-get install -y python-numpy python-dev sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev sudo apt-get install -y libjpeg-dev libpng-dev libtiff-dev libjasper-dev sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils # download opencv-2.4.13 wget http://downloads.sourceforge.net/project/opencvlibrary/opencv-unix/2.4.13/opencv-2.4.13.zip unzip opencv-2.4.13.zip cd opencv-2.4.13 mkdir release cd release # compile and install cmake -G "Unix Makefiles" -D CMAKE_CXX_COMPILER=/usr/bin/g++ CMAKE_C_COMPILER=/usr/bin/gcc -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D BUILD_FAT_JAVA_LIB=ON -D INSTALL_TO_MANGLED_PATHS=ON -D INSTALL_CREATE_DISTRIB=ON -D INSTALL_TESTS=ON -D ENABLE_FAST_MATH=ON -D WITH_IMAGEIO=ON -D BUILD_SHARED_LIBS=OFF -D WITH_GSTREAMER=ON -DBUILD_TIFF=ON .. make all -j8 # 8 cores sudo make install
Reference material
- Discussion on qq group 144081101 591302926 567351477 nail free group 21745728
- Address of the latest version of this article
- python test development library involved in this article Thanks a lot!
- This article related massive books Download
- Source address of this article
- How to install OpenCV 3.4.0 on Ubuntu 16.04
- Ubuntu 18.04: How to install OpenCV
- opencv github
- [opencv] 2.4.13 on ubuntu 14.04
- How to specify new GCC path for CMake
FAQ
- qmake
qmake: could not exec '/usr/lib/x86_64-linux-gnu/qt4/bin/qmake': No such file or directory //Solution: sudo apt get install QT SDK //Reference: https://stackoverflow.com/questions/23703864/cmake-not-working-could-not-exec-qmake