FFT+inverse FFT [message #73890] |
Sun, 05 December 2010 09:48 |
Natalya Lyskova
Messages: 1 Registered: December 2010
|
Junior Member |
|
|
Hey! I'm a beginner at IDL and have problem with FFT. I'm trying to
perform 2d-FFT but the code doesn't work properly even on test images.
So I create an image, make the Fourier transform, then the inverse
Fourier transform and finally I expect to get the initial image. But
the resulting image is the initial one, reversed with respect to the
center.
My code:
nx=256L
x1=findgen(nx)-nx/2.0+1.0
x2=findgen(nx)-nx/2.0+1.0
ytest=fltarr(nx,nx)
for i=0l,nx-1 do begin
for j=0l,nx-1 do begin
if (x1[i] le 20.0 and x1[i] ge 0.0 and x2[j] le 20.0 and x2[j] ge
0.0) then begin
ytest[i,j]=1.0
endif
endfor
endfor
; So the initial image is a squre in the right upper corner
FFTtest=FFT(ytest)
sh_FFTtest=SHIFT(FFTtest,nx/2.0-1.0,nx/2.0-1.0)
inv_test=FFT(FFTtest,-1)
;The result is the square in the LEFT LOWER corner.
I would be very grateful for comments/advices/solutions
Thank for help,
Natalya
|
|
|