Function iahadamard

namespace:ia636
page:iahadamard

Synopse

Hadamard Transform.

  • F = iahadamard(f)
    • F: Image.
    • f: Image.
01. from numpy import *
02. 
03. def iahadamard(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(A, f)
12.     else:
13.         B = iahadamardmatrix(n)
14.         F = dot(dot(A, f), transpose(B))
15.     return F

Examples

Example 1

1. from ia636 import iahadamard
2. 
3. f = iaread('cameraman.pgm')
4. iashow(f)
5. F = iahadamard(f)
6. iashow(log(abs(F)+1))
Warning: downcasting image from double to uint16 (may lose precision)