[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: IDL EPA Exam Test Question

davidf@dfanning.com (David Fanning) writes:
> This is actually a serious question that I was
> asked today from one of my e-mail friends. I know
> it is used to build "frequency images", but what
> are those and how does a DIST image work in that
> context?

When you take the FFT of an image the meaning of coordinate axes
change.  In a transformed image, the coordinates label the *frequency*
of each pixel.  The FFT attempts to decompose the image or signal into
oscillating sine waves with various frequencies; the result is the
amplitude of each wave.

In a 1D transformed image, pixel 0 is the DC amplitude, pixel 1 is the
amplitude of the slowest varying wave, and so on for higher frequency
waves.  For a 2D transformed image you have both an "X" frequency and
a "Y" frequency -- a frequency "image."  The fourier transform also
keeps track of "negative" frequencies, which for some reason are kept
in the second half of the vector.

DIST computes the frequency of each element in such a 2D transformed
image --- or at least is proportional to it.  This would be useful if
you are applying filtering in the frequency domain.  For example if
you wanted to apply an exponential filter to attenuate the high
frequency amplitudes in a 128x128 array, you might do this:

freq = dist(128,128)
fim = fft(im)*exp(-freq)


Craig B. Markwardt, Ph.D.         EMAIL:    craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response