Ask Your Question
0

cv::cuda::convolve artifacts

asked 2019-12-18 11:12:28 -0600

Gandalf2019 gravatar image

updated 2019-12-18 11:13:10 -0600

hi,

I built a convolver using

cv::Ptr<cv::cuda::Convolution> myConv;

and initialize it using:

myConv = cv::cuda::createConvolution(cv::Size(0,0)); // i.e. native optimization

then used it on runtime:

myConv->convolve(src, ker, dst);

the problem is that i get black\white lines parallel to image grid (that wasn't there before and not related to the kernel)

does anyone knows the reason? or how to solve it?

I tried to implement another filtering method:

cv::Ptr<cv::cuda::Filter> filter2D;
filter2D = cv::cuda::createLinearFilter(src.type(), -1, ker);

and use it :

filter2D-> apply(src, dst);

and i ger an error 213 function/feature is not implemented You should explicitly call download method for cuda::GpuMat object in function 'getMat_'

I'm using opencv 4.1.0 on Jetson nano (in both cases).

please advise

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted
0

answered 2020-10-06 14:09:04 -0600

One common mistake is setting size of the kernel (or 0,0) instead of frame size when creating the convolution filter. This might work up to 512 pixels but not above and lead to artifacts. Try using frame size when creating the convolution filter.

edit flag offensive delete link more
0

answered 2019-12-30 03:36:01 -0600

Gandalf2019 gravatar image

Thanks for your answer. I'm using "naive" set of rotated Gabor kernels. I'm following the same approach as shown at the link you shared. The only difference from the example is that i call

cv::Ptr<cv::cuda::Convolution> conv = cv::cuda::createConvolution(cv::Size(0,0));

which is completely equivalent to the call

cv::Ptr<cv::cuda::Convolution> conv = cv::cuda::createConvolution();

and i get the "stitching" lines.

when i define the size to the src image size (at createConvolution(cv::Size(src.rows,src.cols))), there are no stitching lines, however the performance drops significantly, since i'm skipping the convolver size optimization.

Any idea?

edit flag offensive delete link more

Comments

I am not seeing stitching lines.

Have you tried the test code with your kernel, confirming that

EXPECT_MAT_NEAR(dst, dst_gold, 1e-1);

passes?

Can you share your code?

cudawarped gravatar imagecudawarped ( 2019-12-31 01:51:50 -0600 )edit
0

answered 2019-12-19 12:56:32 -0600

Hi, can you share the kernel you are using? Are you following the same approach as shown in the accuracy test?

I tried the CUDA convolution with a random kernel and everything looks OK. The results can be seen at the bottom of this notebook.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-12-18 11:12:28 -0600

Seen: 906 times

Last updated: Dec 30 '19