Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana...
Transcript of Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana...
![Page 1: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/1.jpg)
• Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana Kosecka, CS 685 #
![Page 2: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/2.jpg)
Why do we need Linear Algebra?#
• We will associate coordinates to#– 3D points in the scene#– 2D points in the CCD array#– 2D points in the image#
• Coordinates will be used to#– Perform geometrical transformations#– Associate 3D with 2D points#
• Images are matrices of numbers#– We will find properties of these numbers#
![Page 3: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/3.jpg)
Matrices#
mnmnmn BAC ××× +=Matrix Sum:#
ijijij bac +=
!"
#$%
&=!
"
#$%
&+!"
#$%
&
6478
5126
1352
Example:#
A and B must have the same dimensions#
![Page 4: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/4.jpg)
Matrices#
pmmnpn BAC ××× =
Product:#
∑=
=m
kkjikij bac
1
!"
#$%
&=!
"
#$%
&!"
#$%
&
11192917
5126
.1352
Examples:#
!"
#$%
&=!
"
#$%
&!"
#$%
&
10173218
1352
.5126
nnnnnnnn ABBA ×××× ≠
A and B must have compatible dimensions#
![Page 5: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/5.jpg)
Matrices#
mnT
nm AC ×× =Transpose:#
jiij ac = TTT ABAB =)(
TTT BABA +=+ )(
If # AAT = A is symmetric#
Examples:#
!"
#$%
&=!
"
#$%
&
5216
5126 T
!"
#$%
&=
!!!
"
#
$$$
%
&
852316
835126 T
![Page 6: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/6.jpg)
Matrices#
Determinant:#
131521352
det −=−="#
$%&
'Example:#
A must be square#
3231
222113
3331
232112
3332
232211
333231
232221
131211
detaaaa
aaaaa
aaaaa
aaaaaaaaaa
+−=
"""
#
$
%%%
&
'
122122112221
1211
2221
1211det aaaaaaaa
aaaa
−=="#
$%&
'
![Page 7: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/7.jpg)
Matrices#
IAAAA nnnnnnnn == ××−
×−
×11
Inverse:# A must be square#
!"
#$%
&
−
−
−=!
"
#$%
&−
1121
1222
12212211
1
2221
1211 1aaaa
aaaaaaaa
Example:# !"
#$%
&
−
−=!
"
#$%
&−
6125
281
5126 1
!"
#$%
&=!
"
#$%
&=!
"
#$%
&!"
#$%
&
−
−=!
"
#$%
&!"
#$%
&−
1001
280028
281
5126
.6125
281
5126
.5126 1
![Page 8: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/8.jpg)
2D,3D Vectors#
P#
x1#
x2#
θ#v#
Magnitude:# 22
21|||| xx +=v
Orientation:# !!"
#$$%
&= −
1
21tanxx
θ
!!"
#$$%
&=
||||,||||||||
21
vvvv xx
Is a unit vector#
If # 1|||| =v , # v is a UNIT vector#
![Page 9: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/9.jpg)
Vector Addition, Subtraction, Scalar Product#
v#u#
u+v#
u#v#
u-v#
v#av#
![Page 10: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/10.jpg)
Inner (dot) Product#
v#u#
α#The inner product is a SCALAR!#
norm of a vector#
![Page 11: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/11.jpg)
Vector (cross) Product#
wvu ×=
The cross product is a VECTOR!#
w#v#
α#u#
Orientation:#
€
|| u || = ||v × w ||=||v |||w || sinαMagnitude:#
![Page 12: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/12.jpg)
Standard base vectors:#
Coordinates of a point in space:#
Orthonormal Basis in 3D#
![Page 13: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/13.jpg)
Vector (Cross) Product Computation#
w#v#
α#u#
Skew symmetric matrix associated with vector#
![Page 14: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/14.jpg)
2D Geometrical Transformations#
![Page 15: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/15.jpg)
2D Translation Equation#
x#
X !
Y !
tx#
ty#x’#
t#
![Page 16: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/16.jpg)
Homogeneous Coordinates#
Homogeneous coordinates:
Translation using matrices:
3
![Page 17: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/17.jpg)
Coordinate frames#• In order to specify a position of a rigid body #In 2D space, we need to attach a coordinate #frame to it ##• Frame defines a coordinate system#• Coordinates of any point on the body can be #expressed in that coordinate system#
P = [x,y]’#
![Page 18: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/18.jpg)
Rotation Matrix#
!"
#$%
&!"
#$%
& −=!
"
#$%
&
yx
yx
θθ
θθ
cossinsincos
''
P#x#
Y’#
θ#y#
Counter-clockwise rotation of a coordinate#frame by an angle θ#
Counter-clockwise rotation of a coordinate frame#attached to a rigid body by an angle θ###
{A}#
{B}#
x’#
![Page 19: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/19.jpg)
Rotation Matrix#
Interpretations of the rotation matrix RAB##
{A}#
{B}#
Columns of RAB are the unit vectors of the axes of frame B expressed in coordinate frame A. Such rotation matrix transforms coordinates of points in frame B to points in frame A##
XA = RABXB
�RAB =
�cos � � sin �sin � cos �
⇥
Use of the rotation matrix as transformation RAB ##
![Page 20: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/20.jpg)
Rigid Body Transform#
{A}#
{B}#XA
XB
tAB
XA = XB + tAB
The points from frame A to frame B are transformed by the inverse of#(see example next slide) ##
XA = RABXB + tAB
T = (RAB , tAB)
tAB
T = (RAB , tAB)
Translation only, is the origin of the frame B expressed in the #Frame A #
Composite transformation: #
Transformation: #
XA =�
RAB tAB
0 1
⇥XB
Homogeneous coordinates #
![Page 21: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/21.jpg)
Example#
XA =
�
⇤cos � � sin � txsin � cos � ty
0 0 1
⇥
⌅XB
XA =
�
⇤0 �1 01 0 30 0 1
⇥
⌅XB � = 90o, tAB = [0, 3]Tfor#
{A}#
{B}#XA
XB
tAB
XA =
�
⇤231
⇥
⌅ XB =
�
⇤0�21
⇥
⌅
In homogeneous coordinates: #
Verify that the inverse of the above transform #Transforms coordinates in frame {A} to frame {B} #
![Page 22: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/22.jpg)
Degrees of Freedom#
R is 2x2 # 4 elements#
BUT! There is only 1 degree of freedom: θ#
The 4 elements must satisfy the following constraints:#
!"
#$%
&!"
#$%
& −=!
"
#$%
&
yx
yx
θθ
θθ
cossinsincos
''
Rows and columns are orthogonal and of unit length#Matrix is orientation preserving#
Next transformations in 3D.#
![Page 23: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/23.jpg)
3-D Euclidean Space - Vectors #
A “free” vector is defined by a pair of points :
Coordinates of the vector :
![Page 24: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/24.jpg)
3D Rotation of Points – Euler angles#Rotation around the coordinate axes, counter-clockwise:#
P#x#
Y’#P’# γ#
X’#
y#
z#
![Page 25: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/25.jpg)
Rotation Matrix#• Euler theorem – any rotation can be expressed as a sequence of
rotations around different coordinate axes #• Different order of rotations yields different final rotation#• Rotation multiplication is not commutative#
• Different ways how to obtain final rotation – rotation around 3 axes no successive rotations around same axes#
• XYX, XZX, YXY, YZX, ZXZ, ZYZ – Eulerian involves repetition#• Cardanian – no repetitions XYZ, XZY, YZX, YXZ, ZXY, ZYX. #• Another widely used convention roll-pitch-yaw#
#
R = Rx (θr )Ry (θ p )Rz (θy )
![Page 26: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/26.jpg)
Rotation Matrices in 3D#
• 3 by 3 matrices#• 9 parameters – only three degrees of freedom#• Representations – either three Euler angles#• or axis and angle representation #
• Properties of rotation matrices (constraints between the # elements)#
![Page 27: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/27.jpg)
Rotation Matrices in 3D#• 3 by 3 matrices#• 9 parameters – only three degrees of freedom#• Representations – either three Euler angles#• or axis and angle representation #
#• Properties of rotation matrices (constraints between the # elements)#
Columns are orthonormal#
![Page 28: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/28.jpg)
Rotation Matrix#
• Problem with 3 angle representations: singularities#
• The mapping between angles and Rotation matrix is unique#
• The inverse mapping between Rotation matrix and the angles sometimes cannot be computed or is not unique#
Angle Axis Representation: ##• Two coordinates frames of arbitrary orientations can be related
by a single rotation about ‘some’ axis in space and an angle#
![Page 29: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/29.jpg)
Canonical Coordinates for Rotation#
By algebra#
By solution to ODE#
Property of R#
Taking derivative#
Skew symmetric matrix property#
![Page 30: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/30.jpg)
3D Rotation (axis & angle)#
with#
or#
Solution to the ODE#
![Page 31: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/31.jpg)
Rotation Matrices#
Given#
How to compute angle and axis#
![Page 32: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/32.jpg)
3D Translation of Points#
Translate by a vector #
P#x#Y’#
P’#
x’#
y#z#
z’#
t#
![Page 33: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/33.jpg)
Rigid Body Motion – Homogeneous Coordinates#
3-D coordinates are related by:
Homogeneous coordinates:
Homogeneous coordinates are related by:
![Page 34: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/34.jpg)
Rigid Body Motion – Homogeneous Coordinates#
3-D coordinates are related by:
Homogeneous coordinates:
Homogeneous coordinates are related by:
![Page 35: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/35.jpg)
Properties of Rigid Body Motions#
Rigid body motion composition#
Rigid body motion inverse#
Rigid body motion acting on vectors#
Vectors are only affected by rotation – 4th homogeneous coordinate is zero#
![Page 36: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/36.jpg)
Rigid Body Transformation#
Coordinates are related by:#Camera pose is specified by:#
![Page 37: Linear Algebra Review Rigid Body Motion in 2D Rigid Body Motion in 3D Jana …kosecka/cs685/cs685-rbm.pdf · 2014-08-27 · CS223b, Jana Kosecka# Title: cs685-rbm.ppt Author: Jana](https://reader030.fdocuments.in/reader030/viewer/2022040412/5f0532547e708231d411c1d6/html5/thumbnails/37.jpg)
Rigid Body Motion#
• Shown how to describe positions and orientations of coordinate frames (poses) with respect to the origin world frame#
• Relative pose (R,T) – relationship between two consecutive poses#
CS223b, Jana Kosecka#