Ask Your Question

Gpu sample program error

asked 2012-11-22 14:37:44 -0500

Hi! I installed openCV in my computer and I am trying to work on computer vision with openCV using CUDA. I have downloaded openCV 2.4.3 which is compatible with NVidia SDK 4.2 and I am doing the programming in microsoft visual studion 2008. I have tried one sample program of displaying an image which runs well and I can see the image. However when I am trying to run the sample program given in this website I am getting an error like

error C2440: 'initializing' : cannot convert from 'cv::gpu::GpuMat' to 'cv::Mat'

what is this error about and how can I get rid of it? Thanks for all your cooperation.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-11-22 23:58:38 -0500

Vladislav Vinogradov gravatar image

There is no implicit conversion from GpuMat to Mat. Use upload/download methods, or explicit constructors:

cv::Mat host_mat = imread("pic.png");
cv::gpu::GpuMat gpu_mat(host_mat);
cv::gpu::GpuMat gpu_edges;
cv::gpu::Canny(gpu_mat, gpu_edges, 50, 100);
cv::Mat host_edges;;
edit flag offensive delete link more

Question Tools


Asked: 2012-11-22 14:37:44 -0500

Seen: 1,428 times

Last updated: Nov 22 '12