[iaffine] [Up] [iaresize] Geometric Manipulations

iageorigid
2D Rigid body geometric transformation and scaling.

Synopsis

g = iageorigid( f, scale, theta, t )

Implemented in Python.

Input

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

[srow scol], scale in each dimension

theta Double.

Rotation

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

[trow tcol], translation in each dimension

Output

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

Examples

>>> import Numeric

              
>>> f = iaread('lenina.pgm')

              
>>> g = iageorigid(f, [0.5,0.5], Numeric.pi/4, [0,64])

              
>>> iashow(g)
(256, 256) Min= 39 Max= 224 Mean=58.463 Std=13.73
g

Equation

Source Code

def iageorigid(f, scale, theta, t):
    from Numeric import cos, sin, matrixmultiply
    Ts   = [[scale[1],0,0], [0,scale[0],0], [0,0,1]]
    Trot = [[cos(theta),-sin(theta),0], [sin(theta),cos(theta),0], [0,0,1]] 
    Tx   = [[1,0,t[1]], [0,1,t[0]], [0,0,1]]
    g = iaffine(f, matrixmultiply(matrixmultiply(Tx,Trot), Ts))
    return g
    

See also

iaffine Affine transform.
[iaffine] [Up] [iaresize] http://www.python.org