i have to filter an 2D Image(256*256) but i fail in appliing the filter function to the image frequency using 2D fft.
Using 1D fft works for me but unfortunately it’s really slow.
:Here’s my current method:
I’m using the following filter-function(lowpass, emphasizes edges):
for i = 0:256
filter[i] = i * M_PI * sinf(iM_PI/256.0f/2.0f) / (iM_PI/256.0f/2.0f);
Now I take each row of my image…
pad the row
transfer it into frequncy domain
then multiply each element of my frequency with its corresponding value of my filter
( e.g. cufftComplex[i].x *= filter[i]; cufftComplex[i].y *= filter[i])
normalize each element
transfer from frequency to image doamin
replacing unfiltered row with filtered row
… as mentioned, this works really well … but i have absolutely no idea on how to do that with 2Dfft.
if someone has a suggestion or a hint i would be very thankfull.
Isn’t there an example in the SDK called convolution2DFFT (or something similar) ?
The only problem then is that you have to perform the fftshift yourself (or change the coordinate system) since there is no fftshift function in the CUFFT library.