Reputation: 5679
I want to do the filter2d()
of openCV in freqency domain.
I have read several posts but still it has not become clear to me, how can I get the filtering effect in frequency domain. I have found few posts which tell to convert an image into the frequency domain (i mean, to calculate it's DFT).
I think that I need to do the following steps:
Make a filter kernel
Mat kernel = (Mat_<double>(3,3) << 1.36, 0.062, -0.921,
-0.644198, 1.10, -0.17,
-0.072951, -1.81485, 2.806);
I have found the posts which tell about calculating teh DFT of a grayscale image.
Problem: I don't know how do i perform the multipliaction of step-3 and step-4 on GPU because the documentiona says that the two matrices should be of same size.
Upvotes: 1
Views: 2391
Reputation: 370
You do element-wise multiplication of DFT response of both filter and the image. Before you compute FFT, you have to pad the kernel with zeros to make it the same dimension as that of the image. This is why the FFT option is only computationally efficient if the size of the filter is too large or at least comparable to the dimension of the image.
To have a reasonable estimate along the border of the final matrix, you may have to also pad the image by half of the dimension of the filter.
Upvotes: 2