Function iafftshift

namespace:ia636
page:iafftshift

Synopse

Shifts zero-frequency component to center of spectrum.

  • g = iafftshift(f)
    • OUTPUT
      • g: Image.
    • INPUT
      • f: Image. n-dimensional.

Description

The origin (0,0) of the DFT is normally at top-left corner of the image. For visualization purposes, it is common to periodically translate the origin to the image center. This is particularlly interesting because of the complex conjugate simmetry of the DFT of a real function. Note that as the image can have even or odd sizes, to translate back the DFT from the center to the corner, there is another correspondent function: iaifftshift.

1. from numpy import *
2. 
3. def iafftshift(f):
4.     from ia636 import iaptrans
5. 
6.     f = asarray(f)
7. 
8.     return iaptrans(f, array(f.shape)/2)

Examples

Example 1

1. import ia636 as ia
2. 
3. f = ia.iarectangle([120,150],[7,10],[60,75])
4. F = ia.iadft(f)
5. Fs = ia.iafftshift(F)
6. adshow(ia.iadftview(F))
7. adshow(ia.iadftview(Fs))

1. F = array([[10+6j,20+5j,30+4j],
2.            [40+3j,50+2j,60+1j]])
3. Fs = ia.iafftshift(F)
4. print 'Fs=',Fs
Fs= [[ 60.+1.j  40.+3.j  50.+2.j]
 [ 30.+4.j  10.+6.j  20.+5.j]]

Equation

See Also

Contributions

  • André Luis da Costa, 1st semester 2011