Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

39
Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University

Transcript of Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Page 1: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Projective geometry

ECE 847:Digital Image Processing

Stan BirchfieldClemson University

Page 2: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Lines

• A line in 2D is described by two parameters:

• But vertical lines?• Only two parameters are sufficient,

but requires nonlinear formulation:

slope y-intercept

almost

^

Page 3: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Lines• A better parameterization can represent all lines:

• Here the line is represented by 3 parameters:

• But nonzero scalar multiple does not change the equation:

• So we have only 2 degrees of freedom• To make this work, we have to introduce a non-intuitive

definition:

• I.e., the vector u and its scalar multiple are the same

Page 4: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Lines

• While we are at it, let us put the point into a vector, too:

• Which leads to the beautiful expression:

• Nonzero scalar multiple also does not change the point:

• So we introduce an analogous non-intuitive definition:

Page 5: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Example

• Ques: What does the vector [4, 6, 2]T represent?

• Ans: It depends.

– If the vector is a 2D point, then the point is(4/2, 6/2) = (2, 3) -- divide by 3rd coordinate

– If the vector is a 2D line, then the line is4x + 6y + 2 = 0, or 2x + 3y + 1 = 0

• Points and lines are represented in the same way. Context determines which.

Page 6: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Lines• Ques.: Is the point p on the line u?• Ans: Check whether pTu = 0

• Ques.: Which line passes through two points p1 and p2?

• Ans.: Compute u = p1 x p2

• Ques.: Which points lies at the intersection of two lines?

• Ans.: Compute p = u1 x u2

Page 7: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Euclidean transformation

• 2D Euclidean transformation:

• is more conveniently represented as

• Again, we use 3 numbers to represent 2D point(These are homogeneous coordinates)

Page 8: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Perspective projection

• Nonlinear perspective projection

• can be replaced by linear equation

• where (x,y,w)T are homogeneous coordinates of (u,v,1)T:

Page 9: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Recap

• Homogeneous coordinates of 2D point (x,y)T are p=(wx,wy,w)T where w ≠ 0

• We have seen three reasons for homogeneous coordinates:– simple representation of points and lines, no

special cases– simple representation of Euclidean

transformation– simple representation of perspective

projection

Page 10: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Q & A

• Questions:– Is there a unifying theory to explain

homogeneous coordinates?– How can they be extended to 3D?– Are they useful for anything else?

• Answers:– Projective geometry– Useful for planar warping, 3D

reconstruction, image mosaicking, camera calibration, etc.

Page 11: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Euclidean Projective

• Start with 2D Euclidean point (x,y)

• To convert to Projective,– Append 1 to the coordinates: p=(x,y,1)– Declare equivalence class: p=p, ≠0

• To convert back to Euclidean,– Divide by last coordinate:

(u, v, w) (u/w, v/w) x=u/w, y=v/w

Page 12: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Ideal points

• What if last coordinate is zero?(u,v,0)

• Cannot divide by zero• Projective plane contains more

points than the Euclidean plane:– All Euclidean planes, plus– Points at infinity (a.k.a. ideal points)

• All ideal points lie on ideal line: (0, 0, 1)

Page 13: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Are ideal points special?

• In pure projective geometry, there is no distinction between real points and ideal points– Transformations will often convert one to

another– We will freely make use of this, and often

ignore the distinction

• However, distinction is necessary to convert back to Euclidean– Distinction will be made when we need to

interpret results

Page 14: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Geometries

• Every geometry has– transformations– invariants

Page 15: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Stratification of geometries

• Euclidean

• similarity

• affine

• projective

Page 16: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Ray space

Page 17: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Unit hemisphere

Page 18: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Augmented affine plane

Page 19: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Homogeneous coordinates

Page 20: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Image formation

• 3D world point is (X,Y,Z,W)T

• 2D image point is (x,y,w)T

• Therefore, perspective projection is a 3x4 matrix P

Page 21: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Perspective projection

• Camera calibration matrix K

Page 22: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Homography

• Simple case is projection from plane to plane– Can be either world plane to image plane, or– image plane to another image plane, or– world plane to another world plane, – etc.

• 3x3 matrix is a projective transformation• Called a homography

Page 23: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Euclidean homography

• Needs K

Page 24: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Essential and fundamental matrices

Page 25: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Relationship b/w FM and H

• Fundamental matrix and homography

Page 26: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

How to compute homography

• Direct Linear Transform

Page 27: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Normalization

• Important

Page 28: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Stratification

Euclidean ProjectiveAffineSimilarity

ideal lineabsolute pointsone length

allow scale allow parallelprojection

allow perspectiveprojection

Page 29: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Conics

Page 30: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Circular points

• aka absolute points

Page 31: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Absolute conic

Page 32: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Image of the absolute conic

Page 33: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Calibration using intersecting circles

Page 34: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Calibration using squares

Page 35: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Calibration using vanishing points

Page 36: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Calibration algorithm

Page 37: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Tsai’s calibration routine

Page 38: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

Radial alignment constraint

Page 39: Projective geometry ECE 847: Digital Image Processing Stan Birchfield Clemson University.

What can you do with a calibrated camera