[iaramp] [Up] [iagaussian] Image Creation

iacos
Create a cossenoidal image.

Synopsis

f = iacos( s, t, theta, phi )

Implemented in Python.

Input

s Image. Gray-scale (uint8 or uint16) or binary image (logical).

size: [rows cols].

t Image. Gray-scale (uint8 or uint16) or binary image (logical).

Period: in pixels.

theta Double.

spatial direction of the wave, in radians. 0 is a wave on the horizontal direction.

phi Double.

Phase

Output

f Image. Gray-scale (uint8 or uint16) or binary image (logical).

Description

Generate a cosenosoid image of size s with amplitude 1, period T, phase phi and wave direction of theta. The output image is a double array.

Examples

>>> import Numeric

              
>>> f = iacos([128,256], 100, Numeric.pi/4, 0)

              
>>> iashow(ianormalize(f, [0,255]))
(128, 256) Min= 0.0 Max= 255.0 Mean=128.267 Std=90.04
ianormalize(f, [0,255])

Equation

Source Code

def iacos(s, t, theta, phi):
    from Numeric import cos, sin, pi
    cols, rows = s[1], s[0]
    x, y = iameshgrid(range(cols),range(rows))
    freq = 1./t
    fcols = freq * cos(theta)
    frows = freq * sin(theta)
    f = cos(2*pi*(fcols*x + frows*y) + phi)
    return f
    
[iaramp] [Up] [iagaussian] http://www.python.org