Ubuntu18.04安装openCV+opencv_contrib(编译源码)

参考文章
首先参考上面的文章下载需要的依赖

  1. 下载openCV3.4.1源码
  2. 下载opencv_contrib源码
  3. 进入opencv-3.4.1/build目录,执行
cmake -D CMAKE_BUILD_TYPE=RELEASE \
      -D CMAKE_INSTALL_PREFIX=/usr/local \
      -D INSTALL_C_EXAMPLES=ON \
      -D INSTALL_PYTHON_EXAMPLES=ON \
      -D WITH_TBB=ON \
      -D WITH_V4L=ON \
      -D WITH_QT=ON \
      -D WITH_OPENGL=ON \
      -D BUILD_TIFF=ON \
      -D OPENCV_EXTRA_MODULES_PATH=/home/kneron/file/opencv_contrib/modules/ \
      -D BUILD_EXAMPLES=OFF ..

然后

# find out number of CPU cores in your machine
nproc
# substitute 8 by output of nproc
make -j8
sudo make install
sudo sh -c 'echo "/usr/local/lib" >> /etc/ld.so.conf.d/opencv.conf'
sudo ldconfig

完成!

你可能感兴趣的:(Ubuntu18.04安装openCV+opencv_contrib(编译源码))