Top Banner
Linear Algebra Review
34

Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

Dec 22, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

Linear Algebra Review

Page 2: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 2

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. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 3

Matrices

nmnn

m

m

m

mn

aaa

aaa

aaa

aaa

A

21

33231

22221

11211

mnmnmn BAC Sum:Sum:

ijijij bac

64

78

51

26

13

52Example:Example:

A and B must have the A and B must have the same dimensionssame dimensions

Page 4: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 4

Matrices

pmmnpn BAC Product:Product:

m

kkjikij bac

1

1119

2917

51

26.

13

52

Examples:Examples:

1017

3218

13

52.

51

26

nnnnnnnn ABBA

A and B must have A and B must have compatible dimensionscompatible dimensions

Page 5: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 5

Matrices

mnT

nm AC Transpose:Transpose:

jiij ac TTT ABAB )(

TTT BABA )(

If If AAT A is symmetricA is symmetric

Examples:Examples:

52

16

51

26T

852

316

83

51

26T

Page 6: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 6

Matrices

Determinant:Determinant:

1315213

52det

Example:Example:

A must be squareA must be square

3231

222113

3331

232112

3332

232211

333231

232221

131211

detaa

aaa

aa

aaa

aa

aaa

aaa

aaa

aaa

122122112221

1211

2221

1211det aaaaaa

aa

aa

aa

Page 7: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 7

Matrices

IAAAA nnnnnnnn

11

Inverse:Inverse: A must be squareA must be square

1121

1222

12212211

1

2221

1211 1

aa

aa

aaaaaa

aa

Example:Example:

61

25

28

1

51

261

10

01

280

028

28

1

51

26.

61

25

28

1

51

26.

51

261

Page 8: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 8

2D Vector),( 21 xxv

PP

x1x1

x2x2

vv

Magnitude:Magnitude: 22

21|||| xx v

Orientation:Orientation:

1

21tanx

x

||||,

||||||||21

vvv

v xxIs a unit vectorIs a unit vector

If If 1|||| v , , v Is a UNIT vectorIs a UNIT vector

Page 9: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 9

Vector Addition

),(),(),( 22112121 yxyxyyxx wv

vvww

V+wV+w

Page 10: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 10

Vector Subtraction

),(),(),( 22112121 yxyxyyxx wv

vvww

V-wV-w

Page 11: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 11

Scalar Product

),(),( 2121 axaxxxaa v

vv

avav

Page 12: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 12

Inner (dot) Product

vv

ww

22112121 .),).(,(. yxyxyyxxwv

The inner product is a The inner product is a SCALAR!SCALAR!

cos||||||||),).(,(. 2121 wvyyxxwv

wvwv 0.

Page 13: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 13

Orthonormal Basis

),( 21 xxv

1||||

1||||

j

i

jiv .. 21 xx

PP

x1x1

x2x2

vv

iijj )1,0(

)0,1(

j

i 0ji

12121 0.1.)...(. xxxxx ijiiv

22121 1.0.)...(. xxxxx jjijv

Page 14: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 14

Vector (cross) Product

wvu

The cross product is a The cross product is a VECTOR!VECTOR!

ww

vv

uu

0)(

0)(

wwvwuwu

vwvvuvuOrientation:Orientation:

sin|||||||||.|| ||u|| wvwv Magnitude:Magnitude:

Page 15: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 15

Vector Product Computation

),,(),,( 321321 yyyxxx wvu

kji

kji

u

)()()( 122131132332

321

321

yxyxyxyxyxyx

yyy

xxx

ww

vv

uu

i=(1,0,0)i=(1,0,0)j=(0,1,0)j=(0,1,0)k=(0,0,1)k=(0,0,1) 1k

1j

1i

i.j=0 , i.k=0 , i.j=0 , i.k=0 , j.k=0j.k=0

Page 16: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

2D Geometrical Transformations

Page 17: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 17

2D Translation

tt

PP

P’P’

Page 18: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 18

2D Translation Equation

PP

xx

yy

ttxx

ttyy

P’P’tt

tPP ),(' yx tytx

),(

),(

yx tt

yx

t

P

Page 19: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 19

2D Translation using Matrices

PP

xx

yy

ttxx

ttyy

P’P’tt

),(

),(

yx tt

yx

t

P

1

1

0

0

1' y

x

t

t

ty

tx

y

x

y

xP

tt PP

Page 20: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 20

Homogeneous Coordinates

• Multiply the coordinates by a non-zero scalar and add an extra coordinate equal to that scalar. For example,

0 ),,,(),,(

0 ),,(),(

wwwzwywxzyx

zzzyzxyx

• NOTE: If the scalar is 1, there is no need for the multiplication!

Page 21: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 21

Back to Cartesian Coordinates:

• Divide by the last coordinate and eliminate it. For example,

)/,/,/(0 ),,,(

)/,/(0 ),,(

wzwywxwwzyx

zyzxzzyx

Page 22: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 22

2D Translation using Homogeneous Coordinates

PP

xx

yy

ttxx

ttyy

P’P’tt

1100

10

01

1

' y

x

t

t

ty

tx

y

x

y

x

P

)1,,(),(

)1,,(),(

yxyx tttt

yxyx

t

P tt

PP

PTP ' T

Page 23: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 23

Scaling

PP

P’P’

Page 24: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 24

Scaling Equation

PP

xx

yy

SSxx.x.x

P’P’SSyy.y.y

1100

00

00

1

' y

x

s

s

ys

xs

y

x

y

x

P

)1,,(),('

)1,,(),(

ysxsysxs

yxyx

yxyx

P

P

SPSP '

Page 25: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 25

Scaling & Translating

PP

P’=S.PP’=S.P

P’’=T.P’P’’=T.P’

P’’=T.P’=T.(S.P)=(T.S).PP’’=T.P’=T.(S.P)=(T.S).P

SS

TT

Page 26: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 26

Scaling & TranslatingP’’=T.P’=T.(S.P)=(T.S).PP’’=T.P’=T.(S.P)=(T.S).P

11100

0

0

1100

00

00

100

10

01

''

yy

xx

yy

xx

y

x

y

x

tys

txs

y

x

ts

ts

y

x

s

s

t

t

PSTP

Page 27: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 27

Translating & Scaling Scaling & Translating

P’’=S.P’=S.(T.P)=(S.T).PP’’=S.P’=S.(T.P)=(S.T).P

11100

0

0

1100

10

01

100

00

00

''

yyy

xxx

yyy

xxx

y

x

y

x

tsys

tsxs

y

x

tss

tss

y

x

t

t

s

s

PTSP

Page 28: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 28

Rotation

PP

PP’’

Page 29: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 29

Rotation Equations

Counter-clockwise rotation by an angle Counter-clockwise rotation by an angle

y

x

y

x

cossin

sincos

'

'

PP

xx

Y’Y’PP’’

X’X’

yy R.PP'

Page 30: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 30

Degrees of Freedom

R is 2x2 R is 2x2 4 elements4 elements

BUT! There is only 1 degree of freedom: BUT! There is only 1 degree of freedom:

1)det(

R

IRRRR TT

The 4 elements must satisfy the following constraints:The 4 elements must satisfy the following constraints:

y

x

y

x

cossin

sincos

'

'

Page 31: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 31

Scaling, Translating & Rotating

Order matters!Order matters!

P’ = S.PP’ = S.PP’’=T.P’=(T.S).PP’’=T.P’=(T.S).PP’’’=R.P”=R.(T.S).P=(R.T.S).P P’’’=R.P”=R.(T.S).P=(R.T.S).P

R.T.S R.T.S R.S.T R.S.T T.S.R … T.S.R …

Page 32: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 32

3D Rotation of PointsRotation around the coordinate axes, Rotation around the coordinate axes, counter-clockwisecounter-clockwise::

100

0cossin

0sincos

)(

cos0sin

010

sin0cos

)(

cossin0

sincos0

001

)(

z

y

x

R

R

R

PP

xx

Y’Y’PP’’

X’X’

yy

zz

Page 33: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 33

3D Rotation (axis & angle)

0

0

0

sin)cos1(cos

angle ,

12

13

23

233231

322

221

31212

1

321

nn

nn

nn

nnnnn

nnnnn

nnnnn

nnn T

IIR

n

Page 34: Linear Algebra Review. 6/26/2015Octavia I. Camps2 Why do we need Linear Algebra? We will associate coordinates to –3D points in the scene –2D points in.

04/19/23 Octavia I. Camps 34

3D Translation of Points

Translate by a vector t=(tTranslate by a vector t=(txx,t,tyy,t,txx))TT::

1000

100

010

001

z

y

x

t

t

t

T

PPxxY’Y’

PP’’

x’x’

yyzz

z’z’

tt