[iacorrdemo] [Up] [iadftexamples] Lessons

iadftdecompose
Illustrate the decomposition of the image in primitive 2-D waves.

Description

This demonstration illustrates the decomposition of a step function image into cossenoidal waves of increasing frequencies.

Demo Script

Step function image

The image is created using.

>>> import Numeric

                  
>>> f = Numeric.ones((128, 128)) * 50

                  
>>> x, y = [], map(lambda k:k%128, range(-32,32))

                  
>>> for i in range(128): x = x + (len(y) * [i])

                  
>>> y = 128 * y

                  
>>> Numeric.put(f, iasub2ind([128,128], x, y), 200)

                  
>>> iashow(f)
(128, 128) Min= 50 Max= 200 Mean=125.000 Std=75.00
f

Discrete Fourier Transform

The DFT is computed and displayed

>>> F = iadft(f)

                  
>>> E = iadftview(F)

                  
>>> iashow(E)
(128, 128) Min= 0 Max= 255 Mean=0.737 Std=11.72
>>> g,d = iaplot(iafftshift(F[:,0]).real)
>>> g('set data style impulses')

                  
>>> g.plot(d)
>>> 
E iafftshift(F[:,0]).real
d

[iacorrdemo] [Up] [iadftexamples] http://www.python.org