OpenCV:不支持GPU(该库是在不支持CUDA的情况下编译的)

OpenCV: No GPU support (The library is compiled without CUDA support)

本文关键字:不支持 CUDA 情况下 编译 GPU OpenCV      更新时间:2023-10-16

我安装了带有cmake和选项with_CUDA=ON的opencv 2.4.6.1。我试用了一些示例代码,效果很好。但是gpu库存在一些问题。我在源文件中添加:

cv::gpu::printShortCudaDeviceInfo(cv::gpu::getDevice());

它回来了:OpenCV Error: No GPU support (The library is compiled without CUDA support) in getDevice, file /build/buildd/opencv-2.4.2+dfsg/modules/core/src/gpumat.cpp, line 182 terminate called after throwing an instance of 'cv::Exception' what(): /build/buildd/opencv-2.4.2+dfsg/modules/core/src/gpumat.cpp:182: error: (-216) The library is compiled without CUDA support in function getDevice 我该怎么修?

您的系统上似乎混合了两个不同版本的OpenCV(2.4.6.1和2.4.2)。旧版本(2.4.2)似乎是在没有GPU支持的情况下构建的。

您可以尝试完全删除任何旧版本的OpenCV,然后重新开始2.4.6.1的构建过程。