Re: Can it be done? [message #28693] |
Sat, 05 January 2002 09:31  |
Martin Downing
Messages: 136 Registered: September 1998
|
Senior Member |
|
|
"john" <johnmm91@hotmail.com> wrote in message
news:3C3700C6.527F8BB@hotmail.com...
> Hi
>
> I want to do this:
> Open and read a BMP file
> And then carry out a 2D-FFT
> Save the result as BMP file, but with data shifted such that DC
> component is in the middle of the image.
>
> I tried the followings:
>
> MYIMAGE=READ_TIFF('c:\image2c.tif')
> TV, MYIMAGE
> R=FFT(MYIMAGE)
> TV, R
>
> It seems the displayed result is the FFT result, but is it really a
> 2D-FFT ?
to quote the help docs:
"The FFT function returns a result equal to the complex, discrete Fourier
transform of Array. "
What most people display is the log power spectrum, ie the logarithm of the
complex conjugate:
disp_im = alog(abs(R)+MIN_FOURIER_VALUE)
where MIN_FOURIER_VALUE is added to prevent very low powers dominating the
display
> And could anyone show me how to shift the dc point at the center of the
> display ?
for the shift:
dim = size(r, /dim)
r = shift(r, dim[0]/2, dim[1]/2)
or all in one:
tvscl, alog(abs(shift(r, dim[0]/2, dim[1]/2))+MIN_FOURIER_VALUE)
note the image should have dimentions which are a power of 2
Cheers
Martin
|
|
|