Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Homework Help: IDL programming issue - Fourier transform

  1. Nov 21, 2007 #1
    1. The problem statement, all variables and given/known data
    By the convolution theorem one would expect that if you convolved your image with a kernel in the spatial domain, you would get the exact same result if you multiplied the FFT of the image array by the FFT of the kernel.

    My problem is that I don't get the same results.

    3. What I did:
    1. I first zeropadded the 3x3 kernel so that it was a 256x256 array.
    2. I took the FFT of the zeropadded kernel and I took the FFT of the image array (256x256)
    3. I multiplied these together and then took the inverse FFT to get the filtered image.

    In doing this I get a darker image from the convolution in the spatial domain. I mean I have a non-integer array (no longer an integer greyscale array) which I think is the problem. Does anyone have any ideas as to why this is?? If it helps I've copied the code for this below.

    kernel1zero[3:255, 3:255]=0

    inconvofre1=fft(convolfre1, /inverse)

    window, 8, xsize=512, ysize=256
    tvscl, abs(inconvofre1), 1

    Thanks in advance for any help.
  2. jcsd
  3. Nov 22, 2007 #2
    This is just a guess since I have no idea about IDL, but could you have a rounding problem? Try increasing the number of significant digits if you can.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook