Python 构建OpenCV 4.2以使用CUDA后端-CUDA_cublas_库设置为NOTFOUND(Windows 10)

Python 构建OpenCV 4.2以使用CUDA后端-CUDA_cublas_库设置为NOTFOUND(Windows 10),python,opencv,cmake,Python,Opencv,Cmake,我正在尝试使用CMake构建OpenCV 4.2,以便在Python代码中使用以下函数来使用GPU而不是CPU进行推理(使用CUDA 10.2): 但是,我得到了以下错误: cv::dnn::dnn4_v20191202::Net::Impl::setUpNet DNN module was not built with CUDA backend; switching to CPU 在快速搜索之后,我似乎需要使用CMake(3.17.0)从源代码构建openCV,而不是使用pip安装 我在C

我正在尝试使用CMake构建OpenCV 4.2,以便在Python代码中使用以下函数来使用GPU而不是CPU进行推理(使用CUDA 10.2):

但是,我得到了以下错误:

 cv::dnn::dnn4_v20191202::Net::Impl::setUpNet DNN module was not built with CUDA backend; switching to CPU
在快速搜索之后,我似乎需要使用CMake(3.17.0)从源代码构建openCV,而不是使用pip安装

我在CMake上做了以下操作(使用OpenCV版本4.2,以及建议我使用的版本3.4.2.17):

  • 选择源和生成文件夹
  • 使用OPENCV contrib存储库+/MODULES的路径为OPENCV\u EXTRA\u MODULES\u PATH输入一个值
  • 按配置
  • 与_CUDA条目核对
  • 按配置
  • 压力机生成
我得到立即出现的以下错误:

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:
CUDA_cublas_LIBRARY (ADVANCED)
    linked by target "opencv_cudev" in directory C:/Users/samelson/opencv-3.4.2/modules/cudev
    linked by target "opencv_test_cudev" in directory C:/Users/samelson/opencv-3.4.2/modules/cudev/test
    linked by target ...
以“按目标链接”开头的大量类似行

我在OpenCV的两个版本中得到了相同的错误


有什么提示可以解决这个问题吗?

我按照这个方法使它工作,我按照这个方法使它工作
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:
CUDA_cublas_LIBRARY (ADVANCED)
    linked by target "opencv_cudev" in directory C:/Users/samelson/opencv-3.4.2/modules/cudev
    linked by target "opencv_test_cudev" in directory C:/Users/samelson/opencv-3.4.2/modules/cudev/test
    linked by target ...