Function iaidft

Synopse

Inverse Discrete Fourier Transform.

  • f = iaidft(F)
    • f: Image.
    • F: Image.
01. from numpy import *
02. 
03. def iaidft(F):
04.     from ia636 import iadftmatrix
05. 
06.     s = F.shape
07.     if len(F.shape) == 1: F = F[newaxis,newaxis,:]
08.     if len(F.shape) == 2: F = F[newaxis,:,:]
09. 
10.     (p,m,n) = F.shape
11.     A = iadftmatrix(m)
12.     B = iadftmatrix(n)
13.     C = iadftmatrix(p)
14.     Faux = dot(conjugate(A),F)
15.     Faux = dot(Faux,conjugate(B))
16.     f = dot(conjugate(C),Faux)/(sqrt(p)*sqrt(m)*sqrt(n))
17. 
18.     return f.reshape(s)

Examples

Example 1

01. from numpy import *
02. from ia636 import iadft, iaidft
03. from ia636 import iacircle
04. from ia636 import ianormalize
05. from ia636 import iaifftshift
06. from ia636 import iaisdftsym
07. from ia636 import iadftview
08. 
09. f = iaread('cameraman.pgm')
10. F = iadft(f)
11. print F.shape
12. H = iacircle(F.shape, 50,[F.shape[0]/2,F.shape[1]/2] )
13. H = ianormalize(H,[0,1])
14. FH = F * iaifftshift(H)
15. print iaisdftsym(FH)
16. g=iaidft(FH)
17. adshow(f)
18. adshow(iadftview(F))
19. adshow(ianormalize(H,[0,255]))
20. adshow(iadftview(FH))
21. adshow(ianormalize(abs(g)))
(256, 256)
True

Equation

Contribution