[iadftmatrix] [Up] [iaifftshift] Image Transformation

iafftshift
Shifts zero-frequency component to center of spectrum.

Synopsis

HS = iafftshift( H )

Implemented in Python.

Input

H Image. Gray-scale (uint8 or uint16) or binary image (logical).

FFT image.

Output

HS Image. Gray-scale (uint8 or uint16) or binary image (logical).

Shift of the FFT image.

Description

The origen (0,0) of the DFT is normally at top-left corner of the image. For visualization purposes, it is common to periodicaly translate the origen to the image center. This is particularly 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.

Examples

>>> import Numeric

              
>>> import FFT

              
>>> f = iarectangle([120,150],[7,10],[60,75])

              
>>> F = FFT.fft2d(f)

              
>>> Fs = iafftshift(F)

              
>>> iashow(Numeric.log(abs(F)+1))
(120, 150) Min= 0.0 Max= 4.26267987704 Mean=0.963 Std=0.86
>>> iashow(Numeric.log(abs(Fs)+1))
(120, 150) Min= 0.0 Max= 4.26267987704 Mean=0.776 Std=0.87
Numeric.log(abs(F)+1) Numeric.log(abs(Fs)+1)

Equation

Source Code

def iafftshift(H):
    from Numeric import asarray, NewAxis, array
    H = asarray(H)
    if len(H.shape) == 1: H = H[NewAxis,:]
    HS = iaptrans(H, array(H.shape)/2)
    return HS
    

See also

iaifftshift Undoes the effects of iafftshift.
iaptrans Periodic translation.
iadftview Generate optical Fourier Spectrum for display from DFT data.
[iadftmatrix] [Up] [iaifftshift] http://www.python.org