Documente Academic
Documente Profesional
Documente Cultură
Transformations
2D-to-2D (image-to-image)
3D-to-3D (world-to-world)
3D-to-2D (camera model)
2D-to-3D (shape from X)
Shape from Stereo
Shape from Shading
Shape from Texture
Structure from Motion
Points
World points are 3-Dimensional
P = [X, Y, Z]T
Or in homogeneous coordinates
P = [hX, hY, hZ, h]T
Image points are 2-Dimensional
p = [x, y]T
Or in homogeneous coordinates
p = [hx, hy, h]T
Points
y
y
x
z (1,5,2)T or
(10, 50, 20, 10)T
(5, 6)T or
x
(10, 12, 2)T
Transformations
To define a point, we have to define a
coordinate system
Transformations are functions that
convert points from one coordinate
system to another
Translation, Rotation, Shear, Scaling…
2-D Transformations
Scaling
Original
Translation
Rotation Shear
2D Transformation
Definition: A mapping from one 2D
coordinate system to another
Also called
spatial transformation,
geometric transformation,
warp
Image Registration: Process of transforming
two images so that same features overlap
Example Application:
Image Registration
Reference
Image
Mission
Images
a1 a2 x a1 x a2 y x'
a = =
3 a4 y a3 x a4 y y '
Position Position
Transformation after
before
Matrix transformation
transformation
Example
(0,0) (0,a) (0,0) (0,a)
Apply
0.5 0
0 0.5
(a,0) (a,a) (a,0) (a,a)
Original Transformed
1.5 0
0 0.5 = ?
In general, scaling transformation is given by
sx 0
0 s y
2D Transformations 1 1
0 1 = ?
(0,0) (0,1)
(0,0) (0,1)
(1,0) (1,1)
(1,0) (1,1)
Original
Transformed
(2,1)
Shear in x-direction
1 e x x + ey
0 1 y = y
Shear in y-direction
1 0 x x
e 1 y = ex + y
− 1 0 1 0
0 1 = ? 0 − 1 = ?
− 1 0
0 − 1 = ?
Reflection is negative scaling
Rotation
y
(x2 y2)
(x1 y1)
θ
R
x2 = x1 cosθ − y1 sin θ
(x1 y1)
y2 = x1 sin θ + y1 cosθ
R
θ
y1 = R sin ϕ
ϕ
x2 cos θ − sin θ x1
x y = sin θ cos θ y1
2
x1 = R cos ϕ
R
R is rotation by θ counterclockwise about origin
Rotation
Rotation Matrix has some special
properties
Each row/column has norm of 1 [prove]
Each row/column is orthogonal to the
other [prove]
So Rotation matrix is an orthonormal
matrix
2D Translation
Point in 2D given by (x1 y1)
Translated by (dx dy)
x2 = x1 + dx
y 2 = y1 + d y
Translation
In matrix form
x2 1 0 d x x1
y = 0 1 d y
2 y 1
1 0 0 1 1
Inverse Scaling
1
sx 0 0 s 0 0
x
S = 0 sy 0 S −1 = 0
1
0
sy
0 0 1 0 0 1
S S-1 = I
Inverse Translation
1 0 d x 1 0 − d x
T = 0 1 d y T −1 = 0 1 − d y
0 0 1 0 0 1
T T-1 = I
Inverse Rotation
RR-1 = I
Rotation about an Arbitrary
Point
The rotation matrix that we have
derived is for rotations about the origin
We may want to rotate about some
other point
Solution?
Translate point of rotation to origin,
rotate using normal rotation matrix,
translate back
Concatenation or Composition
of Transformations
We can concatenate a large number of
transformations into a single
transformation
p2 = T[dx dy] S[s s]Rθ p1
Rules of matrix multiplication apply
If we do not use homogeneous
coordinates, what might be the problem
here?
Example
S= sx 0
0 sy
R= cosθ -sinθ
sinθ cosθ
Then
RS = sx cosθ -sy sinθ
sx sinθ sy cosθ
SR = sx cosθ -sx sinθ
sy sinθ sy cosθ
Order of Transformations
In general AB ≠ BA
However, in specific cases, this might
hold true
In the previous example, if sx = sy,
then order of transformations does not
matter
Order of Transformations
Scaled Rotated
Original
Rotated Scaled
Original
Order of Transformations
Scaled Rotated
Original
Rotated Scaled
Original
Order of Transformations
Rotation/Scaling/Shear, followed by
Translation
1 0 b1 a1 a2 0 a1 a2 b1
0 1 b a a4 0 = a3 a4 b2
2 3
0 0 1 0 0 1 0 0 1
Translation, followed by
Rotation/Scaling/Shear
a1 a2 0 1 0 b1 a1 a2 a1b1 + a2b2
a a4 0 0 1 b2 = a3 a4 a3b1 + a4b2
3
0 0 1 0 0 1 0 0 1
Affine Transformation
Consider again the transformation
matrix of Rotation/Scaling/Shear,
followed by Translation
a1 a2 b1
a a4 b2
3
0 0 1
x2 = a1 x1 + a2 y1 + b1
y2 = a3 x1 + a4 y1 + b2
6 parameters
Linear transformation
Parallel lines are preserved [proof ?]
Affine Transformation
Ref: Steve Mann & Rosalind W. Picard, “Video Orbits of the Projective
Group: A simple approach to featureless estimation of parameters”, IEEE
Trans. on Image Processing, Vol. 6, No. 9, September 1997
Affine Transformation
If [a1 … a4] are restricted to pure rotation
matrix, then this case is called rigid-body or
euclidean transformation
1 0
j j
0 1 1 (x , y
j j
n
E (a1 , a2 , a3 , a4 , a5 , a6 ) = ∑ ( x*j − x j ) 2 + ( y *j − y j ) 2
j =1
n
(
E (a) = ∑ (a1 x' j + a2 y ' j + a3 − x j ) 2 + (a4 x' j + a5 y ' j + a6 − y j ) 2
j =1
)
Least Squares Error Solution
n
E (a) = ∑ ((a x + a y + a − x ) + (a x + a y + a − y ) )
1 j 2 j 3
' 2
j 4 j 5 j 6
' 2
j
j =1
Minimize E w.r.t. a
∑ x 2j ∑x y ∑x j j j 0 0 0 ∑ x j x 'j
j j j j
x y 0 a1 ∑ y j x 'j
∑ ∑y ∑y 2
0 0
j
j j
j
j
j
j
j
a2 '
∑ xj ∑ y ∑1 j 0 0 0
a3 ∑
xj
j j j
= j
0 0 0 ∑x ∑x y 2
j j j ∑j x j a4 ∑j x j y 'j
j j a
0 0 0 ∑x y ∑y j j
2
j ∑j y j a5 ∑j y j y 'j
j j 6
0
0 0 ∑x ∑y j j ∑j
1 ∑ j
j
y '
j j