[iaidct] [Up] [iaihadamard] Image Transformation

iaidft
Inverse Discrete Fourier Transform.

Synopsis

f = iaidft( F )

Implemented in Python.

Input

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

Output

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

Examples

>>> import Numeric

              
>>> f = iaread('cameraman.pgm')

              
>>> F = iadft(f)

              
>>> H = iagaussian(F.shape, Numeric.array(F.shape)/2., [[50,0],[0,50]])

              
>>> H = ianormalize(H,[0,1])

              
>>> FH = F * iaifftshift(H)

              
>>> print iaisdftsym(FH)
1
>>> g=iaidft(FH)

              
>>> iashow(f)
(256, 256) Min= 0 Max= 251 Mean=137.066 Std=87.20
>>> iashow(iadftview(F))
(256, 256) Min= 50 Max= 255 Mean=128.205 Std=16.56
>>> iashow(ianormalize(H,[0,255]))
(256, 256) Min= 0.0 Max= 255.0 Mean=1.222 Std=12.42
>>> iashow(iadftview(FH))
(256, 256) Min= 0 Max= 255 Mean=4.047 Std=21.40
>>> iashow(abs(g))
(256, 256) Min= 5.32992978393 Max= 227.023038904 Mean=137.066 Std=71.50
f iadftview(F)
ianormalize(H,[0,255]) iadftview(FH)
abs(g)

Equation

Source Code

def iaidft(F):
    from Numeric import asarray, Complex64, NewAxis, matrixmultiply, conjugate, sqrt
    F = asarray(F).astype(Complex64)
    if len(F.shape) == 1: F = F[:,NewAxis]
    (m, n) = F.shape
    if (n == 1):
        A = iadftmatrix(m)
        f = (matrixmultiply(conjugate(A), F))/sqrt(m)
    else:
        A = iadftmatrix(m)
        B = iadftmatrix(n)
        f = (matrixmultiply(matrixmultiply(conjugate(A), F), conjugate(B)))/sqrt(m*n)
    return f
    

See also

iadft Discrete Fourier Transform.
iaisdftsym Check for conjugate symmetry
[iaidct] [Up] [iaihadamard] http://www.python.org