linear algebra & geometryclasses.engr.oregonstate.edu/.../extra/la-geometry.pdf · linear...

25
Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in this lecture are courtesy to Prof. Octavia I. Camps, Penn State University References: -Any book on linear algebra! -[HZ] – chapters 2, 4

Upload: others

Post on 31-May-2020

44 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Linear Algebra & Geometry why is linear algebra useful in computer vision?

Some of the slides in this lecture are courtesy to Prof. Octavia I. Camps, Penn State University

References:-Any book on linear algebra!-[HZ] – chapters 2, 4

Edited by Yilin Yang and Liang Huang:removed SVD, added eigenvector and covariance matrix links.
Page 2: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Vectors (i.e., 2D vectors)

P

x1

x2θ

v

Magnitude:

Orientation:

Is a unit vector

If , Is a UNIT vector

Page 3: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Vector Addition

vw

v+w

Page 4: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Vector Subtraction

vw

v-w

Page 5: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Scalar Product

vav

Page 6: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Inner (dot) Product

vw

α

The inner product is a SCALAR!

Page 7: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Orthonormal BasisP

x1

x2θ

v

ij

Page 8: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Matrices

Sum:

Example:

A and B must have the same dimensions!

Pixel’s intensity value

An⇥m =

2

6664

a11 a12 . . . a1ma21 a22 . . . a2m...

......

...an1 an2 . . . anm

3

7775

Page 9: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Matrices

Product:

A and B must have compatible dimensions!

An⇥m =

2

6664

a11 a12 . . . a1ma21 a22 . . . a2m...

......

...an1 an2 . . . anm

3

7775

Page 10: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Matrix Inverse

Does not exist for all matrices, necessary (but not su�cient) that

the matrix is square

AA�1= A�1A = I

A�1=

a11 a12

a21 a22

��1

=

1

detA

a22 �a12

�a21 a11

�, detA 6= 0

If detA = 0, A does not have an inverse.

Page 11: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Matrix Determinant

Useful value computed from the elements of a square matrix A

det

⇥a11

⇤= a11

det

a11 a12

a21 a22

�= a11a22 � a12a21

det

2

4a11 a12 a13

a21 a22 a23

a31 a32 a33

3

5= a11a22a33 + a12a23a31 + a13a21a32

� a13a22a31 � a23a32a11 � a33a12a21

Page 12: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Matrix Transpose

Definition:

Cm⇥n = ATn⇥m

cij = aji

Identities:

(A + B)

T= AT

+ BT

(AB)

T= BTAT

If A = AT, then A is symmetric

Page 13: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

2D Geometrical Transformations

Page 14: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

2D Translation

t

P

P’

Page 15: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

2D Translation Equation

P

x

y

tx

tyP’

t

Page 16: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

2D Translation using Matrices

P

x

y

tx

tyP’

t

Page 17: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Scaling

P

P’

Page 18: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Scaling Equation

P

x

y

sx x

P’sy y

Page 19: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

P

P’=S·PP’’=T·P’

P’’=T · P’=T ·(S · P)=(T · S)·P = A · P

Scaling & Translating

P’’

Page 20: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Scaling & Translating

A

Page 21: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Rotation

P

P’

Page 22: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Rotation Equations

Counter-clockwise rotation by an angle θ

P

x

y’P’

θ

x’y

Page 23: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Rotation+ Scaling +TranslationP’= (T R S) P

If sx=sy, this is asimilarity transformation!

Page 24: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Eigenvalues and Eigenvectors

A eigenvalue � and eigenvector u satisfies

Au = �u

where A is a square matrix.

IMultiplying u by A scales u by �

Please see geometric demos at:http://www.sineofthetimes.org/eigenvectors-of-2-x-2-matrices-a-geometric-exploration/See also geometry of covariance matrix:http://www.visiondummy.com/2014/04/geometric-interpretation-covariance-matrix/
Page 25: Linear Algebra & Geometryclasses.engr.oregonstate.edu/.../extra/LA-geometry.pdf · Linear Algebra & Geometry why is linear algebra useful in computer vision? Some of the slides in

Eigenvalues and Eigenvectors

Rearranging the previous equation gives the system

Au� �u = (A� �I)u = 0

which has a solution if and only if det(A� �I) = 0.

IThe eigenvalues are the roots of this determinant which is

polynomial in �.

ISubstitute the resulting eigenvalues back into Au = �u and

solve to obtain the corresponding eigenvector.