Opencv 错误:没有 GPU 支持(库在没有 CUDA 支持的情况下编译)

2022-01-10 00:00:00 opencv c cuda c++

我正在尝试使用 CUDA 在 GPU 上使用 opencv 处理一些图像处理任务.我正在使用 ubuntu.我毫无问题地设置了我的两个产品 Opencv 和 Cuda,我对此很确定.但是,当我尝试在 Eclipse 中运行 sampleCOde 时,出现错误:

I am trying to work some image-process tasks with opencv on GPU with CUDA. I am using ubuntu. I setup my two products Opencv and Cuda without a problem, I am sure about that. However, when I attempt to run sampleCOde in eclipse, I have get an error:

OpenCV 错误:在 mallocPitch,文件/home/muad/Source/OpenCV-2.4.2/modules/core/src/gpumat.cpp,第 749 行中不支持 GPU(编译库时不支持 CUDA)

我重新制作了我的 opencv,但我仍然明白.

I remade my opencv, but I still get that.

推荐答案

如文档中所述,您必须使用 CMake 构建 OpenCV 并设置标志 WITH_CUDA=ON.然后您将获得功能齐全的 OpenCV GPU 模块.否则,该模块仍会构建,但您会收到 CV_GpuNotSupported 异常.

As stated in the documentation, you have to build OpenCV using CMake and set the flag WITH_CUDA=ON. Then you will get the full-featured OpenCV GPU module. Otherwise the module is still built, but you recieve an exception with CV_GpuNotSupported.

有关更多信息,请阅读此处:http://docs.opencv.org/modules/gpu/doc/introduction.html

For further information, read here: http://docs.opencv.org/modules/gpu/doc/introduction.html

相关文章