首先确保CUDA安装正常,CUDA9.0版本及以上安装OpenCV时,按照https://blog.csdn.net/u014613745/article/details/78310916中的方法修改opencv/cmake中的文件,重新编译安装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_nppi_LIBRARY (ADVANCED)
解决办法如下:编译项目时,指定CUDA_nppi_LIBRARY=true:
~# cmake .. -DCMAKE_BUILD_TYPE=Release -DCUDA_nppi_LIBRARY=true
编译成功!