comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » FFT and ROTATE
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
FFT and ROTATE [message #62363] Wed, 03 September 2008 15:20
wheinz is currently offline  wheinz
Messages: 2
Registered: September 2008
Junior Member
Hello,

I have been wrestling with the FFT and ROTATE functions recently. One
of the properties of the Fourier transform is that the transform of a
rotated object is equal to the rotation of the transform of the
unrotated object. To test this in IDL, I took the FFT of an nxn array
(called image) and the FFT of that array rotated 90 degrees, image90 =
ROTATE(image,1). Then, I sorted the real and imaginary parts of the
coefficients of the results of the FFTs and compared the sorted
values. I expected that the sorted list of real parts from the FFT of
the original and rotated arrays would be identical, and that the same
would be true for the imaginary parts. This is not the case. The sets
of the magnitudes of the coefficients are equal, as expected.

I understand that edge effects can play a role, but when I rotate a
square array by 90 degrees, I expect that the sets of real and
imaginary values that define the coefficients to be equal.

Is this a consequence of how the FFT is calculated -- rows first then
columns or vice versa? Or is there something else going on? Any help
or suggestions will be greatly appreciated.

Here is some code I am using to try to wrap my head around this.

Thanks,
Will

pro rotFFTtest
;;load an image
fn = filepath('md1107g8a.jpg',SUBDIRECTORY='examples/data')
image= read_image(fn)
image90 = rotate(image,1)

;display the images
tvscl,image,0
tvscl,image90,1

n = n_elements(image)

;;take fft of image, then get the real and imaginary parts
f = fft(image)
fr = real_part(f)
fi = imaginary(f)

;;take the fft of image90 then get the real and imaginary parts.
f90 = fft(image90)
fr90 = real_part(f90)
fi90 = imaginary(f90)

;;sort and print the real and imaginary parts
frs = sort(fr)
fr90s = sort(fr90)
fis = sort(fi)
fi90s = sort(fi90)

;;print some of the sorted coefficients
print,'fr[frs[[1:4]]',fr[frs[1:4]]
print,'fr90[fr90s[[1:4]]',fr90[fr90s[1:4]]

;print all of the sorted coefficients
;print,'Real','Real rotated','Imag.','Imag. rotated',FORMAT='(4A17)'
;for i = 0L,n-1L do
print,fr[frs[i]],fr90[fr90s[i]],fi[fis[i]],fi90[fi90s[i]],FO RMAT='(4G17.13)'

end
[Message index]
 
Read Message
Previous Topic: Re: Passing Batch File Names
Next Topic: Re: My Last Day on the Job

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 04:56:11 PDT 2025

Total time taken to generate the page: 0.79778 seconds