opencv4.1.0+cuda10.0安装

Install OpenCV=4.1.0

  1. (For CUDA 10.0 only) CUDA 9.x should have no problem. Video decoder is deprecated in CUDA 10.0. To handle this, download NVIDIA VIDEO CODEC SDK and copy the header files to your cuda path (/usr/local/cuda-10.0/include/ for example). Note that you may have to do as root
    unzip Video_Codec_SDK_9.0.20.zip
    cp Video_Codec_SDK_9.0.20/include/nvcuvid.h /usr/local/cuda-10.0/include/
    cp Video_Codec_SDK_9.0.20/include/cuviddec.h /usr/local/cuda-10.0/include/
    cp Video_Codec_SDK_9.0.20/Lib/linux/stubs/x86_64/libnvcuvid.so /usr/local/cuda-10.0/lib64/libnvcuvid.so.1
  2. Obtain required packages for building OpenCV 4.1.0
    sudo apt-get install -y liblapack-dev libatlas-base-dev
    sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev
    sudo apt-get install -y software-properties-common
    sudo add-apt-repository ppa:jonathonf/ffmpeg-4
    sudo apt update
    sudo apt install -y ffmpeg

     

  3. Obtain OpenCV 4.1.0 and its extra modules (optflow, etc.) by
    cd third_party
    wget -O OpenCV-4.1.0.zip wget https://github.com/opencv/opencv/archive/4.1.0.zip
    unzip OpenCV-4.1.0.zip
    wget -O OpenCV_contrib-4.1.0.zip https://github.com/opencv/opencv_contrib/archive/4.1.0.zip
    unzip OpenCV_contrib-4.1.0.zip

     

  4. Build OpenCV 4.1.0 from scratch (due to some custom settings)
    cd opencv-4.1.0
    mkdir build && cd build
    cmake -DCMAKE_BUILD_TYPE=Release \
     -D WITH_CUDA=ON \
     -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-4.1.0/modules/ \
     -D WITH_TBB=ON \
     -D BUILD_opencv_cnn_3dobj=OFF \
     -D CUDA_HOST_COMPILER:FILEPATH=/usr/bin/gcc-5 \
     -D BUILD_opencv_dnn=OFF \
     -D BUILD_opencv_dnn_modern=OFF \
     -D BUILD_opencv_dnns_easily_fooled=OFF \
     -D OPENCV_ENABLE_NONFREE=ON ..
    make -j
    sudo make install

    自己在安装过程中发现的一个非常重要的问题,cuda编译需要的gcc版本和opencv编译需要的gcc版本要求不一样,会导致出错!

类似 #include "features2d/test/test_detectors_regression.impl.hpp"的问题,需要给出从opencv-4.1.0/modules/xfeatures2d/test/下对应文件的绝对路径。

另一个,缺少boostdesc_bgm.i等文件,这里可以提供下载。

百度云链接:https://pan.baidu.com/s/1BeYF8kqEZLAJYQj-MvxpmA

提取码:e1wc

你可能感兴趣的:(opencv+cuda安装,OpenCV,window安装版本)