cv::gpu::blur returns zero Mat when Mat is processed in place

asked 2014-02-06 05:09:41 -0500

Wolf gravatar image

updated 2014-02-06 05:10:15 -0500

With cv::blur on CPU you can process cv::Mat in place like:

// have defined and filled cv::Mat my_mat
cv::blur( my_mat, my_mat, cv::Size( 4, 4 ) );

If I try the same thing with cv::gpu::GpuMat and cv::gpu::blur like

// have defined and filled cv::gpu::GpuMat my_mat
cv::gpu::blur( my_mat, my_mat, cv::Size( 4, 4 ) );

my_mat is now just all zeros, i. e. black.

If I create an empty GpuMat header, pass it to blur and assign to Mat everything again works like CPU example:

// have defined and filled cv::gpu::GpuMat my_mat
cv::gpu::GpuMat tmp;
cv::gpu::blur( my_mat, tmp, cv::Size( 4, 4 ) );
my_mat = tmp;

I think this is a bug in cv::gpu::blur, isn't it?

I am using ubuntu 12.04 64 bit with cuda 5.5 and OpenCV 2.4.7

edit retag flag offensive close merge delete



GPU filters doesn't work in-place.

Vladislav Vinogradov gravatar imageVladislav Vinogradov ( 2014-02-06 12:03:02 -0500 )edit

Thanks for reply. Doc of FilterEngine mentions this. Maybe the doc of blur etc. should also mention it, or the functions should assert on this. Took me quite a while to find this error when porting from CPU to GPU....

Wolf gravatar imageWolf ( 2014-02-07 04:57:59 -0500 )edit