[iaihadamard] [Up] [iaisdftsym] Image Transformation

iaihwt
Inverse Haar Wavelet Transform.

Synopsis

F = iaihwt( 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')

              
>>> iashow(f)
(256, 256) Min= 0 Max= 251 Mean=137.066 Std=87.20
>>> F = iahwt(f)

              
>>> g = iaihwt(F)

              
>>> print Numeric.sum(Numeric.sum(abs(f.astype(Numeric.Float)-g.astype(Numeric.Float))))
2.68465338849e-009
f

Source Code

def iaihwt(f):
    from Numeric import asarray, Float64, NewAxis, matrixmultiply, transpose
    f = asarray(f).astype(Float64)
    if len(f.shape) == 1: f = f[:,NewAxis]
    (m, n) = f.shape
    A = iahaarmatrix(m)
    if A==-1: return -1
    if (n == 1):
        F = matrixmultiply(transpose(A), f)
    else:
        B = iahaarmatrix(n)
        if B==-1: return -1
        F = matrixmultiply(matrixmultiply(transpose(A), f), B)
    return F
    
[iaihadamard] [Up] [iaisdftsym] http://www.python.org