Ubuntu installation under Opencv summary

Disclaimer: This article is a blogger original article, please indicate the source: https: //blog.csdn.net/qq_31261509 https://blog.csdn.net/qq_31261509/article/details/90606183

opencv is an open source graphical image processing library, has been widely used in computer vision, opencv summarized in this chapter show a variety of installation: source installation and online installation

Opencv-line installation

Opencv line installation is very simple, through the command line you can directly download the corresponding library files, you can call


  • If you want to use opencv of c ++ interface directly through the following command to install:
sudo apt install libopencv-dev
  • If you want a python opencv Interface, first install pip, and then execute the following command to install:
pip install opencv-python
  • Opencv install the contrib module can not call the above two methods, if you want to call contrib module you need to compile the source code installation:

First, download opencv source codecs, and then enter the file after decompression opencv folder, do the following

cd ${opencv_dir}   #进入opencv文件夹
mkdir build        # 创建build文件夹
cd build           # 进入build目录
cmake ..           # cmake 编译前资源准备工作
make -j5           # make 编译代码
sudo make install  # 讲编译成功后生成文件安装进系统路径中

Note that, in cmake preparation phase, you need to download the network may need to wait a long time, so you can compile the source code [install Opencv offline] by following the installation, save download time

Opencv offline installation

opencv offline installation source installation need, particularly in some Linux systems can not mount an online time


Compile modules mounted substantially opencv

  • Preparing for Installation

If you download the source by cmake after installation, you need to download ippicv networking module, so here we can download the appropriate module in advance

  • Download ippicv modules:

First open 3rdparty / ippicv / ippicv.cmake under opencv directory, find the need to download the version of ippicv and enter opencv_3rdparty download (Cmake message command can be used to view ippicv version needed), if the download speed is slow, you can download the installation package provide me with .

  • Then modify ippicv.cmake content:
  set(THE_ROOT "${OpenCV_BINARY_DIR}/3rdparty/ippicv")
  ocv_download(FILENAME ${OPENCV_ICV_NAME}
               HASH ${OPENCV_ICV_HASH}
               URL
                 "${OPENCV_IPPICV_URL}"
                 "$ENV{OPENCV_IPPICV_URL}"
---              "https://raw.githubusercontent.com/opencv/opencv_3rdparty/${IPPICV_COMMIT}/ippicv/"
+++           "file:/home/ubuntu/Downloads/"   # ippipcv的下载目录,注意Downloads后面/不能缺省
               DESTINATION_DIR "${THE_ROOT}"
               ID IPPICV
               STATUS res
               UNPACK RELATIVE_URL)

After editing, the compiler can compile successfully use cmake

The module is installed opencv contrib

First you need to download xfeatures2d dependent on them under the build / downloads files in the directory folder opencv, will be placed after face_landmark_model.dat download under build / share / OpenCV / testdata / cv / face / directory. Finally cmake && make install to compile

opencv3.4 Baidu network disk download module package connected

Links: https://pan.baidu.com/s/14JulhLuPIPDuo20oZbTpxA
extraction code: agrf
copy the contents of this open Baidu network disk phone App, the operation more convenient oh

Guess you like

Origin blog.csdn.net/qq_31261509/article/details/90606183