# 2D FFT

## Recommended Posts

Icebraker    122
Hi, I have implemented a noise algorithm and would like to see it's behaviour in the frequency domain. Therefore I have rendered it in an image and performed a 2D-FFT. I am sure my FFT is correct, but I don't know how to scale the values correctly to get an FFT image like http://www.qsimaging.com/ccd_noise_interpret_ffts.html. I have one array of thew size N*N, which stores the absolute value of the FFT. Can anybody please give me a hint how to scale the values (they are in the range 0 to 10000) correctly to get these images? Uniform division by the largest value does not work because it reduces all other small values to 0.. Thanks, Icebraker

##### Share on other sites
TOmcAT23    194
Scaling depends on what you use to plot the image. If you do this in say matlab with imagesc then it will automatically scale the values (highest value = white, lowest value = black). I think you should post an example of what you are currently getting and what you are using to plot. If you want something as good as the results shown on that website you might need to perform thresholding.

##### Share on other sites
Brother Bob    10344
To get those images, uniform division by the largest magniture IS what you want. Small non-zero values are reduced to zero because they are small and you're using limited precision. If you need non-zero values, you need a higher precision datatype.

edit: Actually, on a second thought, you may want to scale the logarithm of the magnitude to the range of your datatype. Keep in mind though that a simple scaling is not really enough, you need to offset the lowest value to zero first.

##### Share on other sites
I don't know that much about FFT in image processing, but in audio processing, we only ever consider the amplitudes on a logarithmic scale - it is the natural way to view phenomena that reside in an exponential domain (such as sound loudnesses as a function of wave amplitude).

However, I'm not thoroughly convinced that this is appropriate for bounded greyscale images. The Fourier transform simply takes the signal from the second spatial- to the frequency-domain; it doesn't scale any of the values. I recommend you temporarily adapt your noise function into something with a predictable frequency distribution (I mean superpositions of harmonic waves). This way, you can determine if the problem lies with the noise generation, the FFT or the plot.