Using 1D Kernel on 2D fft Image filtering

Hey everybody,

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…

  1. pad the row
  2. transfer it into frequncy domain
  3. 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])
  4. normalize each element
  5. transfer from frequency to image doamin
  6. 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.

best regards, rob

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.