Computer Vision – Transformations, Imaging Geometry and Stereo Based Reconstruction
Geometric Transformations
-
Upload
curran-beach -
Category
Documents
-
view
46 -
download
1
description
Transcript of Geometric Transformations
Geometric Transformations
UBI 516 Advanced Computer GraphicsUBI 516 Advanced Computer Graphics
Aydın Öztü[email protected]://ube.ege.edu.tr/~ozturk
Two Dimensional Geometric Transformations
Basic TransformationsBasic Transformations
Translation
P
P'
x
yyx tyytxx ','
y
x
t
t
y
x
y
xTP'P ,
'
',
TPP'
Basic Transformations
Rotation
x
y
y)(x,P θ
φ
)('
)('
rSiny
rCosx
)(),( rSinyrCosx
)()('
)()('
yCosxSiny
ySinxCosx
P′=(x′,y′)
r
Rotation (Cont.)
R.PP'
y
x
y
x
CosSin
SinCos
CosSin
SinCosR
'
'
Basic Transformations
Scaling
yx syysxx .',.'
PSP
'
.0
0
'
'
y
x
s
s
y
x
y
x
x
y
Basic Transformations
3x3 Matrix Representations
We can combine the multiplicative and translational terms for 2D transformations into a single matrix representation by expanding the 2x2 matrix representations to 3x3 matrices.
This allows us to express all transformation equations as matrix multiplications.
Homogeneous Coordinates
We represent each Cartesian coordinate position (x,y) with the homogeneous coordinate triple
where
),,( hyx hh
hy
yhx
x hh ,
Homogeneous Coordinates(cont.)
Thus, a general homogeneous coordinate representation can also be written as
For 2D transformations we choose h=1.
Each 2D position is represented with
homogeneous coordinates
),.,.( hyhxh
)1,,( yx
Translation in homogeneous coordinates
1
.
100
10
01
1
'
'
y
x
t
t
y
x
y
x
PTP ),(' yx tt
Rotation in homogeneous coordinates
1
.
100
0
0
1
'
'
y
x
CosSin
SinCos
y
x
PRP ).('
Scaling in homogeneous coordinates
1
.
100
00
00
1
'
'
y
x
s
s
y
x
y
x
PSP ).,(' yx ss
Composite Transformations:Translation
If two successive translation are applied to a point P, then the final transformed location P' is calculated as
100
10
01
100
10
01
.
100
10
01
21
21
1
1
2
2
yy
xx
y
x
y
x
tt
tt
t
t
t
t
PTPTTP ),(),(),('21211122 yyxxyxyx tttttttt
Composite Transformations:Rotation
100
0)()(
0)()(
100
0
0
.
100
0
0
2121
2121
11
11
22
22
CosSin
SinCos
CosSin
SinCos
CosSin
SinCos
PRP )(' 21
Composite Transformations:Scalings
100
00
00
100
00
00
100
00
00
21
21
1
1
2
2
yy
xx
y
x
y
x
ss
ss
s
s
s
s
),(),(),(21211122 yyxxyxyx ssssssss SSS
General Pivot Point Rotation
Steps:
-Translate the object so that the pivot point is moved to the coordinate origin.
-Rotate the object about the origin.
-Translate the object so that the pivot point is returned to its original position.
General Pivot Point Rotation(Cont.)
General Pivot Point Rotation(Cont.)
100
)1(
)1(
100
10
01
.
100
1
0
.
100
10
01
SinxCosyCosSin
SinyCosxSinCos
y
x
CosSin
SinCos
y
x
rr
rr
r
r
r
r
),,(),()(),( rrrrrr yxyxyx RTRT
General Fixed Point Scaling
Steps:
-Translate the object so that the fixed point coincides with the coordinate origin.
-Scale the object about the origin.
-Translate the object so that the pivot point is returned to its original position.
General Fixed Point Scaling
(xr, yr) (xr, yr)
General Fixed Point Scaling
100
)1(0
)1(0
100
10
01
.
100
00
00
.
100
10
01
yfy
xfx
f
f
y
x
f
f
sys
sxs
y
x
s
s
y
x
),,,(),(),(),( yxffffyxff ssyxyxssyx STST
Concatenation Properties
Matrix multiplication is associative
Transformation product is not commutative
)()( CBACBACBA
ABBA
OTHER TRANSFORMATIONS
Reflection
About x-axis About y-axis
x
y
1
2 3
2 3
1
100
010
001
100
010
001
OTHER TRANSFORMATIONS
x
y
1
2
3
2
1
3
100
010
001
Reflection about the origin
OTHER TRANSFORMATIONS
Reflection about the line y=x.
x
y2
2
1
3
100
001
010
y = x
2
3
OTHER TRANSFORMATIONS
100
010
01xhs
Shear
x-direction shearx x
y y
TRANSFORMATION BETWEEN COORDINATE SYSTEMS
Individual objects may be defined in their local cartesian reference system.
The local coordinates must be transformed to position the objects within the scene coordinate system.
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.)
Steps for coordinate transformation
-Translate so that the origin (x0, y0 ) of the x′-y′ system is moved to the origin of the x-y system.
-Rotate the x′ axis on to the axis x.
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.)
y
x
x′y′
θ
x0
y0
0
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.)
y
x
x′
x0
y0
0
y′
θ
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.)
y
xx′ x0
y0
0
y′
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.)
),()(
100
0
0
)(
100
10
01
),(
00'',
0
0
00
yx
CosSin
SinCos
y
x
yx
yxxy
TRM
R
T
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.)
An alternative method: -Specify a vector V that indicates the direction for the positive y′ axis. Let
-Obtain the unit vector u=(ux ,u y) along the x′ axis by rotating v 900 clockwise.
),( yx vvVV
v
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.)
-Elements of any rotation matrix can be expressed as elements of orhogonal unit vectors. That is, the rotation matrix can be written as
100
0
0
yx
yx
vv
uu
R
TRANSFORMATION BETWEEN COORDINATE SYSTEMS(Cont.)
y
x
x′y′
x0
y0
0
V
Three Dimensional Geometric Transformations
P=(x,y,z)
x
3D Translation
P′=(x′,y′,z′)y
z
PTP
'
1
.
1000
100
010
001
1
'
'
'
z
y
x
t
t
t
z
y
x
z
y
x
3D Translation
3D Rotation(z-axis)
z-axis rotation
P=(x,y,z)
x
y
z
3D Rotation(z-axis)
1
.
1000
0100
00
00
1
'
'
'
z
y
x
CosSin
SinCos
z
y
x
PRP ).(' z
zz
yxy
yxx
'
cossin'
sincos'
x-axis rotation
P=(x,y,z)
x
y
z
3D Rotation(x-axis)
3D Rotation(x-axis)
PRP ).(' x
1
.
1000
00
00
0001
1
'
'
'
z
y
x
CosSin
SinCos
z
y
x
xx
zyz
zyy
xzyx
'
cossin'
sincos'
y-axis rotation
P=(x,y,z)
x
y
z
3D Rotation(y-axis)
3D Rotation(y-axis)
11000
00
0010
00
1
'
'
'
z
y
x
CosSin
SinCos
z
y
x
PRP ).(' y
yy
xzx
xzz
'
cossin'
sincos'
General 3D Rotation Rotation about an axis that is parallel to
x-axes.
-Translate object so that the rotation axis coincides with the parallel coordinate axis.
-Perform specified rotation about the axis.
-Translate the object so that the rotation axis is moved back to its original position.
PTRTP 1 .)(' x
Rotation about an axis that is parallel to x-axes.
Rotation axis
x
y
z
General 3D Rotation
Rotation about an axis that is not parallel to one of the coordinate axes.
-Translate object so that the rotation axis passes through the coordinate origin.
-Rotate object so that the axis of rotation coincides with one of the coordinate axes.
-Perform the specified rotation about that coordinate axis
-Apply inverse rotations to bring the rotation axis back to its original orientation.
-Apply the inverse translation to brig the rotation axis back to its original position.
Rotation about an axis that is not parallel to one of the coordinate axes.
Rot
atio
n ax
isx
y
z
P2
P1
Initial Position
Rotation about an axis that is not parallel to one of the coordinate axes.
x
y
z
P2
P1
Translate P1 to the origin
Rotation about an axis that is not parallel to one of the coordinate axes.
x
y
z
P 2
P 1
Rotate P2 onto the z-axis and rotate the object around it.
Rotation about an axis that is not parallel to one of the coordinate axes.
x
y
z
P2
P1
Rotate the axis to the original orientation
Rotation about an axis that is not parallel to one of the coordinate axes.
x
y
z
P2
P1
Translate the rotation axis to the original position
Rotation about an axis that is not parallel to one of the coordinate axes.
An axis vector is defined by two points as
A unit vector is defined as
1PPV 2
),,( cbaVV
u
Rotation about an axis that is not parallel to one of the coordinate axes.
The first step is to set up the translation matrix
1000
100
010
001
1
1
1
z
y
x
T
Rotation about an axis that is not parallel to one of the coordinate axes. The next step is to put the rotation axis
on the z-axis.
x
y
z
u
Rotation about an axis that is not parallel to one of the coordinate axes. First, we rotate about the x-axis to transform u into the x-z
plane.
x
y
z
u
α
Rotation about an axis that is not parallel to one of the coordinate axes.
First, we rotate about the x-axis to transform u into the x-z plane.
x
y
z
u
α
u′
Uz=(0,0,1)
α
22
'
')(
),,(
cbd
d
cCos
cba
z
z
uu
uu
u
Rotation about an axis that is not parallel to one of the coordinate axes. We can define the sine of α from the cross product of u and u′.
dbSin
dSinb
Sindb
dand
bcb
Sin
xx
z
x
zyx
z
zxz
/
)1)((
'1
100
0'
''
uu
uu
u
uuu
uu
uuuuu
Rotation about an axis that is not parallel to one of the coordinate axes.
The rotation matrix is
1000
0//0
0//0
0001
)(dcdb
dbdcx R
Rotation about an axis that is not parallel to one of the coordinate axes.
x
y
z
u
β
Rotation about an axis that is not parallel to one of the coordinate x-axes.
1000
00
0010
00
)(da
ad
y R
Rotation about an axis that is not parallel to one of the coordinate x-axes.
TRRRRRTR
R
)()()()()()(
1000
0100
00sin
00sin
)(
111
xyzyx
z
Cos
Cos