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

Home » Public Forums » archive » Re: Reorganizing 2D FFT for Conventional Viewing [?]
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Reorganizing 2D FFT for Conventional Viewing [?] [message #4453] Fri, 23 June 1995 00:00
Chris Jacobsen is currently offline  Chris Jacobsen
Messages: 10
Registered: December 1994
Junior Member
For 2D FFT, I like to do

n=256
it=complexarr(n,n)
it_xform=shift(fft(shift(it,n/2,n/2),-1),n/2,n/2)
Re: Reorganizing 2D FFT for Conventional Viewing [?] [message #4463 is a reply to message #4453] Thu, 22 June 1995 00:00 Go to previous message
Rolf P. W\"urtz is currently offline  Rolf P. W\"urtz
Messages: 3
Registered: June 1995
Junior Member
trond@smith.phys.ucalgary.ca (Trond Steinar Trondsen) wrote:
> I'm trying to rearrange the 2D FFT so that zero frq is in the middle,
> and all other frqs end up in the right place.

sx = size(x)
y=fft(x, -1)
rearranged = shift(y,sx(1)/2, sx(2)/2)

If youre array dimensions are even, zero frq cannot be in the middle,
it ends up at coords sx(1)/2, sx(2)/2.

Greetings
Rolf
Re: Reorganizing 2D FFT for Conventional Viewing [?] [message #4464 is a reply to message #4463] Thu, 22 June 1995 00:00 Go to previous message
rivers is currently offline  rivers
Messages: 228
Registered: March 1991
Senior Member
In article <3s9jdc$dsc@ds2.acs.ucalgary.ca>, trond@smith.phys.ucalgary.ca (Trond Steinar Trondsen) writes:
> I'm trying to rearrange the 2D FFT so that zero frq is in the middle,
> and all other frqs end up in the right place. Using the Fourier shift
> theorem prior to transforming does work, but it really slows things down!
> Doing lots of loops to simply rearrange the final array takes a while
> too, and it doesn't look very nice....
> Any _elegant_ (fast) ways of doing this?
>
a = fltarr(256, 256)
b = fft(a, 1)
; b will be 256x256 with the zero frequency in the "corners"
b = shift(b, 128, 128) ; Put zero frequency in the middle

____________________________________________________________
Mark Rivers (312) 702-2279 (office)
CARS (312) 702-9951 (secretary)
Univ. of Chicago (312) 702-5454 (FAX)
5640 S. Ellis Ave. (708) 922-0499 (home)
Chicago, IL 60637 rivers@cars3.uchicago.edu (Internet)
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: [Q] hybrid median filter
Next Topic: Re: Can anyone explain?

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

Current Time: Wed Oct 08 15:52:22 PDT 2025

Total time taken to generate the page: 0.00500 seconds