Running the Canny filter on the GPU (error: ‘Canny’ is not a member of ‘cv::gpu’) [closed]

asked 2015-03-31 02:39:14 -0600

updated 2015-04-01 10:42:17 -0600

Hello all,

I am using OpenCV 2.4.9 with Cuda support on Funtoo Linux (installed via Portage).

Here is the offending method:

cv::gpu::GpuMat edgesR;
cv::gpu::GpuMat img;
img.create(getN(), getM(), CV_8UC1);
cv::gpu::Canny(img, edgesR, 120.0, 30.0, 3);

While compiling a project made with a former version of OpenCV, the compiler tells me

error: ‘Canny’ is not a member of ‘cv::gpu’

AFAIK this means the compiler couldn't find the relevant function. It then tells me I might want to use cv::Canny instead.

I see that in OpenCV 3, cv::gpu:: will be moved to cv::cuda::. However, I'm using 2.4.9, so I assume that's not related. I read the online documentation, and I can see Canny in cv::gpu::, so I'm not sure what's wrong here: http://docs.opencv.org/modules/gpu/doc/image_processing.html?highlight=gpu%20canny#gpu-canny

How can I use the Cuda GPGPU version of the Canny filter in OpenCV?

I'm going to use the CPU version cv::Canny instead, since it seems I can't use cv::gpu::Canny. Does this one automagically use CUDA if available?

EDIT: Turns out using cv::Canny instead of cv::gpu::Canny throws an assert error:

openCV Error: Assertion failed (k == STD_VECTOR_MAT) in getMat, file /var/tmp/portage/media-libs/opencv-2.4.9/work/opencv-2.4.9/modules/core/src/matrix.cpp, line 988
terminate called after throwing an instance of 'cv::Exception'
  what():  /var/tmp/portage/media-libs/opencv-2.4.9/work/opencv-2.4.9/modules/core/src/matrix.cpp:988: error: (-215) k == STD_VECTOR_MAT in function getMat

Best regards.

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-11-06 16:19:31.290016