3D Geometry for Computer Graphics Class 7. 2 The plan today Review of SVD basics Connection PCA...

36
3D Geometry for Computer Graphics Class 7
  • date post

    21-Dec-2015
  • Category

    Documents

  • view

    221
  • download

    0

Transcript of 3D Geometry for Computer Graphics Class 7. 2 The plan today Review of SVD basics Connection PCA...

3D Geometry forComputer Graphics

Class 7

2

The plan today

Review of SVD basics Connection PCA Applications:

Eigenfaces Animation compression

3

The geometry of linear transformations

A linear transform A always takes hyper-spheres to hyper-ellipses.

A

A

4

The geometry of linear transformations

Thus, one good way to understand what A does is to find which vectors are mapped to the “main axes” of the ellipsoid.

A

A

5

Spectral decomposition

If we are lucky: A = V VT, V orthogonal The eigenvectors of A are the axes of the ellipse

A

6

Spectral decomposition

The standard basis:

RotationVT

x

y

Au = V VTu

xy

7

Spectral decomposition

Scaling: x’’ = 1 x’, y’’ = 2 y’

Scale

Au = V VTu

xy xy

8

Spectral decomposition

Rotate back:

RotateV

Au = V VTu

xy

x

y

9

General linear transformations: SVD

In general A will also contain rotations, not just scales:

A

1

21 2 1 2

T

n n

n

A

u u u v v v

1 1 2

1

TA U V

10

SVD

The standard basis:

RotationVT

x

y

Au = U VTu

xy

11

Spectral decomposition

Scaling: x’’ = 1 x’, y’’ = 2 y’

Scale

Au = U VTu

xy xy

12

Spectral decomposition

Rotate again:

RotateU

Au = U VTu

xy

x

y

13

SVD more formally

SVD exists for any matrix Formal definition:

For square matrices A Rnn, there exist orthogonal matrices U, V Rnn and a diagonal matrix , such that all the diagonal values i of are non-negative and

TA U V

=

A U TV

14

Reduced SVD

For rectangular matrices, we have two forms of SVD. The reduced SVD looks like this: The columns of U are orthonormal Cheaper form for computation and storage

A U TV

=

Mn Mn nn nn

15

Full SVD

We can complete U to a full orthogonal matrix and pad by zeros accordingly

A U TV

=

Mn MM Mn nn

16

SVD is the “working horse” of linear algebra

There are numerical algorithms to compute SVD. Once you have it, you have many things: Matrix inverse can solve square linear systems Numerical rank of a matrix Can solve least-squares systems PCA Many more…

17

SVD is the “working horse” of linear algebra

Must remember: SVD is expensive! For a nn matrix, SVD costs O(n3). For sparse matrices could sometimes be cheaper

18

Shape matching

We have two objects in correspondence Want to find the rigid transformation that aligns

them

19

Shape matching

When the objects are aligned, the lengths of the connecting lines are small.

20

Shape matching – formalization

Align two point sets

Find a translation vector t and rotation matrix R so that:

1 1 and, , ., ,n nQP p qp q

2

1

( ) is minimizedn

i ii

R

p tq

21

Summary of rigid alignment

Translate the input points to the centroids:

Compute the “covariance matrix”

Compute the SVD of H:

The optimal rotation is

The translation vector is

i ii i qp p qp q

1

nT

i ii

H

q p

TH U V

TR VU

R t p q

H is 22 or 33 matrix!

=

22

SVD for animation compression

Chicken animation

23

3D animations

Each frame is a 3D model (mesh) Connectivity – mesh faces

24

3D animations

Each frame is a 3D model (mesh) Connectivity – mesh faces Geometry – 3D coordinates of the vertices

25

3D animations

Connectivity is usually constant (at least on large segments of the animation)

The geometry changes in each frame vast amount of data, huge filesize!

13 seconds, 3000 vertices/frame, 26 MB

26

Animation compression by dimensionality reduction

The geometry of each frame is a vector in R3N space (N = #vertices)

1

1

1

N

N

N

x

x

y

y

z

z

3N f

27

Animation compression by dimensionality reduction

Find a few vectors of R3N that will best represent our frame vectors!

1

1

1

N

N

N

x

x

y

y

z

z

=

1

2

f

1

2

f

VT

U 3Nf ff VT ff

1 2 f

28

Animation compression by dimensionality reduction

The first principal components are the important ones

1

1

1

N

N

N

x

x

y

y

z

z

=

u1 u2 u3

1

2

f

VT

1

2

3

0

0

29

1

1

1

N

N

N

x

x

y

y

z

z

Animation compression by dimensionality reduction

Approximate each frame by linear combination of the first principal components

The more components we use, the better the approximation

Usually, the number of components needed is much smaller than f.

= u1 u2 u31 + 2 + 3

30

Animation compression by dimensionality reduction

Compressed representation: The chosen principal component vectors

Coefficients i for each frame

ui

Animation with only2 principal components

Animation with20 out of 400 principal

components

31

Eigenfaces

Same principal components analysis can be applied to images

32

Eigenfaces

Each image is a vector in R250300

Want to find the principal axes – vectors that best represent the input database of images

33

Reconstruction with a few vectors

Represent each image by the first few (n) principal components

1 1 2 2 1 2, , ,n n n v u u u

34

Face recognition

Given a new image of a face, w R250300

Represent w using the first n PCA vectors:

Now find an image in the database whose representation in the PCA basis is the closest:

1 1 2 2 1 2, , ,n n n w u u u

1 2, , ,

, is the largest

n

w

w w

The angle between w and w’ is the smallestw w’

w’

w

35

Non-linear dimensionality reduction

More sophisticated methods can discover non-linear structures in the face datasets

Isomap,Science, Dec. 2000

See you next time