Function iageorigid

namespace:ia636
page:iageorigid

Synopse

2D Rigid body geometric transformation and scaling.

  • g = iageorigid(f, scale, theta, t)
    • g: Image.
    • f: Image.
    • scale: Image. [scol srow], scale in each dimension
    • theta: Double. Rotation
    • t: Image. [tcol trow], translation in each dimension
01. from numpy import *
02. 
03. def iageorigid(f, scale, theta, t):
04.     from iaffine import iaffine
05. 
06.     Ts   = [[scale[1],0,0], [0,scale[0],0], [0,0,1]]
07.     Trot = [[cos(theta),-sin(theta),0], [sin(theta),cos(theta),0], [0,0,1]]
08.     Tx   = [[1,0,t[1]], [0,1,t[0]], [0,0,1]]
09.     g = iaffine(f, dot(dot(Tx,Trot), Ts))
10.     return g

Examples

Example 1

1. from ia636 import iageorigid
2. 
3. f = adread('lenina.pgm')
4. adshow(f, 'original')
5. g = iageorigid(f, [1,1], 0, [32,64])
6. adshow(g, 'translated by (32,64)')

original

translated by (32,64)

Example 2

1. from ia636 import iageorigid
2. 
3. f = adread('lenina.pgm')
4. adshow(f,'original')
5. g = iageorigid(f, [0.5,0.5], pi/4, [0,64])
6. adshow(g,'scaled: 0.5, rot: 45, trans: (0,64)')

original

scaled: 0.5, rot: 45, trans: (0,64)

Equation

See Also