Function iaihadamard

namespace:ia636
page:iaihadamard

Synopse

Inverse Hadamard Transform.

  • F = iaihadamard(f)
    • F: Image.
    • f: Image.
01. from numpy import *
02. 
03. def iaihadamard(f):
04.     from iahadamardmatrix import iahadamardmatrix
05. 
06.     f = asarray(f).astype(float64)
07.     if len(f.shape) == 1: f = f[:,newaxis]
08.     (m, n) = f.shape
09.     A = iahadamardmatrix(m)
10.     if (n == 1):
11.         F = dot(transpose(A), f)
12.     else:
13.         B = iahadamardmatrix(n)
14.         F = dot(dot(transpose(A), f), B)
15.     return F

Examples

Example 1

1. from ia636 import iaihadamard
2. from ia636 import iahadamard
3. 
4. f = iaread('cameraman.pgm')
5. iashow(f)
6. F = iahadamard(f)
7. g = iaihadamard(F)
8. print sum(sum(abs(f.astype(float)-g.astype(float))))
0.0