Function iaidct

namespace:ia636
page:iaidct

Synopse

Inverse Discrete Cossine Transform.

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

Examples

Example 1

1. from ia636 import iaidct
2. from ia636 import iadct
3. 
4. f = iaread('cameraman.pgm')
5. iashow(f)
6. F = iadct(f)
7. g = iaidct(F)
8. print sum(sum(abs(f-g)))
1.40344974198e-07