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

Home » Public Forums » archive » Re: 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
Re: FFT and ROTATE [message #62357 is a reply to message #62326] Thu, 04 September 2008 06:37 Go to previous messageGo to previous message
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
On Sep 3, 5:20 pm, whe...@gmail.com wrote:
> 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

This might help, too: http://cimss.ssec.wisc.edu/~paulv/fft/fft_comparison.html
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: map plotting
Next Topic: block fill image

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

Current Time: Fri Oct 10 10:30:41 PDT 2025

Total time taken to generate the page: 0.16200 seconds