日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

编译OpenCV 2+ with CUDA 9+

發布時間:2023/11/27 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 编译OpenCV 2+ with CUDA 9+ 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

編譯很頭疼,出現以下問題:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
opencv_dep_CUDA_nppi_LIBRARY
linked by target "opencv_core" in directory /home/kamal/packages/opencv-2.4.13.3/modules/core
linked by target "opencv_core" in directory /home/kamal/packages/opencv-2.4.13.3/modules/core
linked by target "opencv_flann" in directory /home/kamal/packages/opencv-2.4.13.3/modules/flann
linked by target "opencv_imgproc" in directory /home/kamal/packages/opencv-2.4.13.3/modules/imgproc
linked by target "opencv_highgui" in directory /home/kamal/packages/opencv-2.4.13.3/modules/highgui
linked by target "opencv_features2d" in directory /home/kamal/packages/opencv-2.4.13.3/modules/features2d
linked by target "opencv_calib3d" in directory /home/kamal/packages/opencv-2.4.13.3/modules/calib3d
linked by target "opencv_ml" in directory /home/kamal/packages/opencv-2.4.13.3/modules/ml

……

1.
修改opencv/cmake/FindCUDA.cmake 文件,將524行的

unset(CUDA_nppi_LIBRARY CACHE)

修改為

unset(CUDA_nppial_LIBRARY CACHE)
unset(CUDA_nppicc_LIBRARY CACHE)
unset(CUDA_nppicom_LIBRARY CACHE)
unset(CUDA_nppidei_LIBRARY CACHE)
unset(CUDA_nppif_LIBRARY CACHE)
unset(CUDA_nppig_LIBRARY CACHE)
unset(CUDA_nppim_LIBRARY CACHE)
unset(CUDA_nppist_LIBRARY CACHE)
unset(CUDA_nppisu_LIBRARY CACHE)
unset(CUDA_nppitc_LIBRARY CACHE)

修改opencv/cmake/FindCUDA.cmake 文件,將799行和801行的

find_cuda_helper_libs(nppi)
set(CUDA_npp_LIBRARY"${CUDA_nppc_LIBRARY};${CUDA_nppi_LIBRARY};${CUDA_npps_LIBRARY}")

修改為

find_cuda_helper_libs(nppial)
find_cuda_helper_libs(nppicc)
find_cuda_helper_libs(nppicom)
find_cuda_helper_libs(nppidei)
find_cuda_helper_libs(nppif)
find_cuda_helper_libs(nppig)
find_cuda_helper_libs(nppim)
find_cuda_helper_libs(nppist)
find_cuda_helper_libs(nppisu)
find_cuda_helper_libs(nppitc)
set(CUDA_npp_LIBRARY "${CUDA_nppc_LIBRARY};${CUDA_nppial_LIBRARY};${CUDA_nppicc_LIBRARY};${CUDA_nppicom_LIBRARY};${CUDA_nppidei_LIBRARY};${CUDA_nppif_LIBRARY};${CUDA_nppig_LIBRARY};${CUDA_nppim_LIBRARY};${CUDA_nppist_LIBRARY};${CUDA_nppisu_LIBRARY};${CUDA_nppitc_LIBRARY};${CUDA_npps_LIBRARY}")

2.

更改 OpenCVDetectCUDA.cmake 文件,將74行中的

    if(CUDA_GENERATION STREQUAL "Fermi")set(__cuda_arch_bin "2.0 2.1(2.0)")elseif(CUDA_GENERATION STREQUAL "Kepler")if(${CUDA_VERSION} VERSION_LESS "5.0")set(__cuda_arch_bin "3.0")else()set(__cuda_arch_bin "3.0 3.5")endif()

修改成

     if(CUDA_GENERATION STREQUAL "Fermi")set(__cuda_arch_bin "3.0 3.5")elseif(CUDA_GENERATION STREQUAL "Kepler")if(${CUDA_VERSION} VERSION_LESS "5.0")set(__cuda_arch_bin "3.0")else()set(__cuda_arch_bin "3.0 3.5")endif()

將107行

      if(${CUDA_VERSION} VERSION_LESS "5.0")set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0")elseif(${CUDA_VERSION} VERSION_GREATER "6.5")set(__cuda_arch_bin "2.0 2.1(2.0) 3.0 3.5")else()set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5")endif()set(__cuda_arch_ptx "3.0")endif()

修改成

      if(${CUDA_VERSION} VERSION_LESS "5.0")set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0")elseif(${CUDA_VERSION} VERSION_GREATER "6.5")set(__cuda_arch_bin "3.0 3.5")else()set(__cuda_arch_bin "1.1 1.2 1.3 2.0 2.1(2.0) 3.0 3.5")endif()set(__cuda_arch_ptx "3.0")endif()

如果大家懶,就直接下載我修改好的吧,替換自己的兩個文件就好了

總結

以上是生活随笔為你收集整理的编译OpenCV 2+ with CUDA 9+的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。