Danping lecture04-projective geometry SVD

55
Lecture 04- Projective Geometry EE382-Visual localization & Perception Danping Zou @Shanghai Jiao Tong University 1

Transcript of Danping lecture04-projective geometry SVD

Page 1: Danping lecture04-projective geometry SVD

Lecture 04- Projective Geometry

EE382-Visual localization & PerceptionDanping Zou @Shanghai Jiao Tong

University

1

Page 2: Danping lecture04-projective geometry SVD

Projective geometry

2

• Key concept - Homogenous coordinates– Represent an -dimensional vector by a

dimensional coordinate

– Can represent infinite points or lines

Danping Zou @Shanghai Jiao Tong University

Homogenous coordinate Cartesian coordinate

August Ferdinand Möbius 1790-1868

Page 3: Danping lecture04-projective geometry SVD

2D projective geometry• Point representation:

– A point can be represented by a homogenous coordinate:

Danping Zou @Shanghai Jiao Tong University 3

Homogeneous coordinates:

Inhomogeneous coordinates:

Page 4: Danping lecture04-projective geometry SVD

2D projective geometry• Line representation:

– A line is represented by a line equation:

Hence a line can be naturally represented by a homogeneous coordinate:

It has the same scale equivalence relationship:

Danping Zou @Shanghai Jiao Tong University 4

Page 5: Danping lecture04-projective geometry SVD

2D projective geometry• A point lie on a line is simply described as:

where and .

Danping Zou @Shanghai Jiao Tong University 5

A point or a line has only two degree of freedom (DoF, 自由度).

Page 6: Danping lecture04-projective geometry SVD

2D projective geometry• Intersection of lines:

– The intersection of two lines is computed by the cross production of the two homogenous coordinates of the two lines:

Danping Zou @Shanghai Jiao Tong University 6

Intersection of lines

Here, ‘ ‘ represents cross production

Page 7: Danping lecture04-projective geometry SVD

2D projective geometry• Example of intersection of two lines: Let the two

lines be

• The intersection point is computed as :

• The inhomogeneous coordinate is

Danping Zou @Shanghai Jiao Tong University 7

Page 8: Danping lecture04-projective geometry SVD

2D projective geometry• Line across two points:

• The line across the two points is obtained by the cross production of the two homogenous coordinates of the two points:

Danping Zou @Shanghai Jiao Tong University 8

Page 9: Danping lecture04-projective geometry SVD

2D projective geometry• Idea point (point at infinity):

– Intersection of parallel lines– Let two parallel lines bewhere . Their intersection is computed as

Danping Zou @Shanghai Jiao Tong University 9

Its inhomogeneous coordinates are meaningless:

The point with the last coordinate x3 =0 is called idea points

Page 10: Danping lecture04-projective geometry SVD

2D projective geometry• Line at infinity : all idea points lies on

Danping Zou @Shanghai Jiao Tong University 10

A geometric interpolation

• Points and lines in the 2D plane are represented by 3D rays and planes respectively.

• The idea points lies in -plane and - plane represents

Page 11: Danping lecture04-projective geometry SVD

2D projective geometry• Projective transformation:

– A projective transformation is an invertible mapping such that three points ଵ ଶ ଷ lie on the same line if

and only if ଵ ଶ ଷ do.– A projective transformation is also called as

• A collineation• A homography

– A homography is a linear transformation on homogeneous 3-vectors represented by a non-singular 3 × 3 matrix:

Danping Zou @Shanghai Jiao Tong University 11

Page 12: Danping lecture04-projective geometry SVD

2D projective geometry• Given a transformation of points ,

the transformation of lines is given by .

Danping Zou @Shanghai Jiao Tong University 12

Page 13: Danping lecture04-projective geometry SVD

2D projective geometry• An example of projective transformation

Danping Zou @Shanghai Jiao Tong University 13

Page 14: Danping lecture04-projective geometry SVD

2D projective geometry• A hierarchy of transformations

Danping Zou @Shanghai Jiao Tong University 14

Isometries

Similarity transformation

Affine transformation

Projective transformation

Page 15: Danping lecture04-projective geometry SVD

2D projective geometry• Isometrics : Euclidean transformation [+ Reflection]

Danping Zou @Shanghai Jiao Tong University 15

Euclidean transformation

Reflection + Euclidean transformation

Rotation

Translation

A isometric transformation has 3 degree of freedom, whose invariants include length, angle and area.

3DoF

Page 16: Danping lecture04-projective geometry SVD

2D projective geometry• Similarity transformation

Danping Zou @Shanghai Jiao Tong University 16

A isometric transformation has 4 degree of freedom, with one more degree of freedom on the scaling.

It preserves the ‘shape’, angle.

Page 17: Danping lecture04-projective geometry SVD

2D projective geometry• An Affine transformation is a non-singular linear

transformation which has the following form:

Danping Zou @Shanghai Jiao Tong University 17

6DoF

Page 18: Danping lecture04-projective geometry SVD

2D projective geometry• Projective transformation

• Can be decomposed into a chain of essential transformations:

Danping Zou @Shanghai Jiao Tong University 18

Similarity Pure Affine Pure projective

8DoF

Scale

Page 19: Danping lecture04-projective geometry SVD

Summary

Danping Zou @Shanghai Jiao Tong University 19

* Page 44 Multiple-view Geometry for Computer Vision

Page 20: Danping lecture04-projective geometry SVD

Summary• Homogenous/inhomogenous coordinates• 2D points vs.. 2D lines• Points / lines at infinity• Projective transformation, Homography• Hierarchy of transformations:

– Isometrics (Euclidean) ->similarity->affine->projective

Danping Zou @Shanghai Jiao Tong University 20

Page 21: Danping lecture04-projective geometry SVD

3D projective geometry• The homogeneous a 3D point is represented by

• Its inhomogeneous coordinates is

• The projective transformation in 3D space is a linear transformation on homogeneous 4-vectors, represented by a non-singular matrix:

Danping Zou @Shanghai Jiao Tong University 21

Page 22: Danping lecture04-projective geometry SVD

3D projective geometry• A plane in 3D space is written as

• Let the point on the plane be ,we have :

Danping Zou @Shanghai Jiao Tong University 22

Plane normal

Page 23: Danping lecture04-projective geometry SVD

3D projective geometry• Transformation of planes :

Danping Zou @Shanghai Jiao Tong University 23

Page 24: Danping lecture04-projective geometry SVD

3D projective geometry• Joint and incidence relations

– A plane is defined uniquely by three distinct points– Three planes intersect in a unique point– Two distinct planes intersect in a unique line

Danping Zou @Shanghai Jiao Tong University 24

Page 25: Danping lecture04-projective geometry SVD

3D projective geometry• Three points define a plane :

• The rank of is 3, how to solve this equation?– Method #1. Compute the basis of the null space of– Method #2. Let ସ , solve the following equation:

Danping Zou @Shanghai Jiao Tong University 25

Page 26: Danping lecture04-projective geometry SVD

About the null space & SVD• Fundamentals

– Range (column space) : range(A) is the space spanned by the columns of the matrix A.

– Null space : null(A) is a space where all the vectors satisfy

– Rank : The rank is the dimension of the column space

Danping Zou @Shanghai Jiao Tong University 26

Page 27: Danping lecture04-projective geometry SVD

About the null space & SVD• Use SVD to compute the null space of a matrix.• The Singular Value Decomposition (SVD) is a basic

tool to analysis a matrix. • Many problems of linear algebra can be better

understood if we first ask the question:what if we take the SVD ?

Danping Zou @Shanghai Jiao Tong University 27

Page 28: Danping lecture04-projective geometry SVD

SVD• The SVD is motivated by the following geometric

fact:– The image of the unit sphere under any matrix

is a hyper-ellipse (超椭球)

Danping Zou @Shanghai Jiao Tong University 28

Orthogonal bases of the original space

Orthogonal bases of the target space

Page 29: Danping lecture04-projective geometry SVD

SVD• From the geometric interpretation, we have the

following equations: . • By collecting all those equations together, we have

or compactly, . Since has orthogonal columns, we get

Danping Zou @Shanghai Jiao Tong University 29

Page 30: Danping lecture04-projective geometry SVD

SVD• Back to the 2D case, we have

Danping Zou @Shanghai Jiao Tong University 30

Left singular vectors Singular values Right singular vectors

Page 31: Danping lecture04-projective geometry SVD

SVD• Step by step interpretation

– Step 1. map (rotation + with/without reflection) the bases to the canonical frame.

Danping Zou @Shanghai Jiao Tong University 31

Page 32: Danping lecture04-projective geometry SVD

SVD• Step by step interpretation

– Step 2. Stretch the axes

Danping Zou @Shanghai Jiao Tong University 32

Page 33: Danping lecture04-projective geometry SVD

SVD• Step by step interpretation

– Step 3. rotate the canonical axes

Danping Zou @Shanghai Jiao Tong University 33

Page 34: Danping lecture04-projective geometry SVD

SVD• In the step 2, what if we set ?

Danping Zou @Shanghai Jiao Tong University 34

• We have :is the null space of A

Page 35: Danping lecture04-projective geometry SVD

Null space from SVD• So the null space of a matrix can be obtained by

SVD decomposition.• The bases of the null space are the right singular

vectors that corresponds to the zero singular values.

Danping Zou @Shanghai Jiao Tong University 35

Page 36: Danping lecture04-projective geometry SVD

3D projective geometry• Back to the plane problem: Three points define a

plane :

• Its null space can be solved by SVD

Danping Zou @Shanghai Jiao Tong University 36

Page 37: Danping lecture04-projective geometry SVD

3D projective geometry• Three planes define a point:

• Its null space can be solved by SVD

Danping Zou @Shanghai Jiao Tong University 37

Page 38: Danping lecture04-projective geometry SVD

Summary• 3D points vs. 3D Planes • Transformations of 3D points and 3D lines• Three planes define a point / Three points define a

plane• How to solve a homogenous equation• Null space of a matrix• Geometric interpretation of SVD

Danping Zou @Shanghai Jiao Tong University 38

Page 39: Danping lecture04-projective geometry SVD

3D projective geometry• Hierarchy of 3D transformation

Danping Zou @Shanghai Jiao Tong University 39

Page 40: Danping lecture04-projective geometry SVD

• Euclidean transformation (Rigid body transformation)

• A mapping is a rigid body transformation if it satisfies 1) Length is preserved :

2) The cross product is preserved:

3D projective geometry

Danping Zou @Shanghai Jiao Tong University 40

Page 41: Danping lecture04-projective geometry SVD

3D projective geometry• Homogenous form vs. inhomogenous form

• About the rotation matrix

Danping Zou @Shanghai Jiao Tong University 41

Homogenous:

Inhomogenous:

Page 42: Danping lecture04-projective geometry SVD

3D projective geometry• 3D Rotation matrix transforms three

orthogonal axes into r1, r2, r3 in the new coordinate system.

Danping Zou @Shanghai Jiao Tong University 42

r1

r2

r3

More about 3D rotation will be discussed in the later lectures.

Page 43: Danping lecture04-projective geometry SVD

3D projective geometry• Exercise:

1. Write a small program to compute the harries corner detector. Show all the intermediate results as shown in the slides. Requirements:1) source codes + executable (any language, but with details how to run it)2) result analysis (world <= 2 pages)

2. Write a small program to rectify a distorted planar image to a normal one as shown (Page 13)Requirements - The same as the previous one.

Danping Zou @Shanghai Jiao Tong University 43

Deadline : Oct 27th

Page 44: Danping lecture04-projective geometry SVD

3D Lines• A line is defined by join of two points or intersection

of two planes.

• Lines have 4 degrees of freedom in 3D-space

Danping Zou @Shanghai Jiao Tong University 44

Page 45: Danping lecture04-projective geometry SVD

3D Lines• Plücker matrix: A line can be defined from two

points and

• Plücker matrix is a skew-symmetric matrix

Danping Zou @Shanghai Jiao Tong University 45

Page 46: Danping lecture04-projective geometry SVD

3D Lines• The rank of a Plücker matrix is 2. Its null space is the

pencil of planes with the line as the axis.

• Under the point transformation , the matrix transforms as :

Danping Zou @Shanghai Jiao Tong University 46

Page 47: Danping lecture04-projective geometry SVD

3D Lines• Determinant of a Plücker matrix

Danping Zou @Shanghai Jiao Tong University 47

Page 48: Danping lecture04-projective geometry SVD

3D Lines• Independent of the two selected points

• Let and be two different point on the same line, we have

Danping Zou @Shanghai Jiao Tong University 48

Equivalent up to scale

Page 49: Danping lecture04-projective geometry SVD

3D Lines• Dual Plücker matrix :

– Let two planes be

• has similar properties to Plücker matrix

Danping Zou @Shanghai Jiao Tong University 49

Page 50: Danping lecture04-projective geometry SVD

3D Lines• Join and incidence properties

(1) Plane from the join of a point and a line

if and only if , is on

Danping Zou @Shanghai Jiao Tong University 50

Page 51: Danping lecture04-projective geometry SVD

3D Lines• Join and incidence properties

(2) Point from the intersection of a line and a plane

if and only if , is on

Danping Zou @Shanghai Jiao Tong University 51

Page 52: Danping lecture04-projective geometry SVD

3D Lines• Plücker line : A compact and meaningful

representation from the Plücker matrix

• Correspond to the Plücker matrix as :

Danping Zou @Shanghai Jiao Tong University 52

Page 53: Danping lecture04-projective geometry SVD

3D Lines• Plücker constrain is satisfied:

Danping Zou @Shanghai Jiao Tong University 53

Page 54: Danping lecture04-projective geometry SVD

3D Lines• Plücker line representation

Danping Zou @Shanghai Jiao Tong University 54

1. n is a vector normal to the plane containing the line and the origin

2. v is a direction vector of line, oriented from a to b

3. is the orthogonal distance from the line to the origin

Page 55: Danping lecture04-projective geometry SVD

Summary• Plücker matrix• Dual Plücker matrix• Plücker lines

Danping Zou @Shanghai Jiao Tong University 55