Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only...

20
1 Epipolar Geometry Prof. D. Stricker With slides from A. Zisserman, S. Lazebnik, Seitz 1. Short introduction: points and lines 2. Two views geometry: Epipolar geometry Relation point/line in two views The geometry of two cameras Definition of the fundamental matrix F Outline

Transcript of Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only...

Page 1: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

1

Epipolar GeometryProf. D. Stricker

With slides from A. Zisserman, S. Lazebnik, Seitz

1. Short introduction: points and lines

2. Two views geometry: Epipolar geometry• Relation point/line in two views• The geometry of two cameras• Definition of the fundamental matrix F

Outline

Page 2: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

2

(0,0,0)

Recall: The projective plane

• Why do we need homogeneous coordinates?• represent points at infinity, homographies, perspective

projection, multi-view relationships• What is the geometric intuition?

• a point in the image is a ray in projective space

(sx,sy,s)

• Each point (x,y) on the plane is represented by a ray (sx,sy,s)

– all points on the ray are equivalent: (x, y, 1) (sx, sy, s)

image plane

(x,y,1)-y

x-z

• Projective Transformation: linear transformation that keeps lines.• Projective Space: an extension of the Euclidian space where two lines

always meet.

x = x/1y = y/1

Homogeneouscoordinates in P2

(x,y,0) = (x/0,y/0,0) = (∞,∞,0)Point at Infinity

Euclidian Coordinates

R2

(x,y) = (x,y,1) = (kx,ky,k) k ≠ 0 i.e. Position

i.e. Direction

Recall: 2D projective Geomety

Page 3: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

3

Projective lines

• What does a line in the image correspond to in projective space?

• A line is a plane of rays through origin– all rays (x,y,z) satisfying: ax + by + cz = 0

• A line is also represented as a homogeneous 3-vector llT p

l

Point and line duality• A line l is a homogeneous 3-vector• It is to every point (ray) p on the line: lTp=0

p1p2

What is the intersection of two lines l1 and l2 ?• p is to l1 and l2 p = l1 l2

Points and lines are dual in projective space• given any formula, can switch the meanings of points and lines to

get another formula

l1l2

p

What is the line l spanned by rays p1 and p2 ?• l is to p1 and p2 l = p1 p2

• l is the plane normal

Page 4: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

4

q1

Example: Computing vanishing points (from lines)

• Intersect p1q1 with p2q2

v

p1

p2

q2

In practice: least squares version• Better to use more than two lines and compute the “closest” point of

intersection• See notes by Bob Collins for one good way of doing this: http://www-

2.cs.cmu.edu/~ph/869/www/notes/vanishing.txt

Intersection of parallel lines

Intersections of parallel lines

Exampletangent vector

normal direction

Skew matrix of l

Page 5: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

5

1. Short introduction: points and lines

2. Two views geometry: Epipolar geometry• Relation point/line in two views• The geometry of two cameras• Definition of the fundamental matrix F

OutlineStereo head

Camera on a mobile vehicle

Page 6: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

6

range map

Pentagon exampleleft image right image Scenarios

The two images can arise from

• A stereo rig consisting of two cameras• the two images are acquired simultaneously

or

• A single moving camera (static scene)• the two images are acquired sequentially

The two scenarios are geometrically equivalent

Page 7: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

7

The objective

Given two images of a scene acquired by known cameras compute the 3D position of the scene (structure recovery)

Basic principle: triangulate from corresponding image points

• Determine 3D point at intersection of two back-projected rays

Corresponding points are images of the same scene point

Triangulation

C C /

The back-projected points generate rays which intersect at the3D scene point

Page 8: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

8

An algorithm for stereo reconstruction

1. For each point in the first image determine the corresponding point in the second image

(this is a search problem)

2. For each pair of matched points determine the 3D point by triangulation

(this is an estimation problem)

The correspondence problem

Given a point x in one image find the corresponding point in the other image

This appears to be a 2D search problem, but it is reduced to a 1D search by the epipolar constraint

Page 9: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

9

1. Epipolar geometry

• the geometry of two cameras• reduces the correspondence problem to a line search

2. Stereo correspondence algorithms

3. Triangulation

General outline of 3D reconstruction

TODAY

Notation

x x /

X

C C /

The two cameras are P and P/, and a 3D point X is imaged as

for equations involving homogeneous quantities ‘=’ means ‘equal up to scale’

P P/

Warning

Page 10: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

10

Epipolar geometry

Given an image point in one view, where is the corresponding point in the other view?

epipolar line

?

baseline

• A point in one view “generates” an epipolar line in the other view• The corresponding point lies on this line

epipole C /C

Epipolar line

Epipolar constraint• Reduces correspondence problem to 1D search along an

epipolar line

Page 11: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

11

Epipolar geometry

Epipolar geometry is a consequence of the coplanarity of the camera centres and scene point

x x /

X

C C /

The camera centres, corresponding points and scene point lie in a single plane, known as the epipolar plane

Nomenclature

• The epipolar line l/ is the image of the ray through x

• The epipole e is the point of intersection of the line joining the camera centres with the image plane

this line is the baseline for a stereo rig, and

the translation vector for a moving camera

• The epipole is the image of the centre of the other camera: e = PC/ , e/ = P/C

x x /

X

C C /

e

left epipolar lineright epipolar line

e/

l/

Page 12: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

12

The epipolar pencil

e e /

baseline

X

As the position of the 3D point X varies, the epipolar planes “rotate” about the baseline. This family of planes is known as an epipolar pencil. All epipolar lines intersect at the epipole.

(a pencil is a one parameter family)

The epipolar pencil

e e /

baseline

X

As the position of the 3D point X varies, the epipolar planes “rotate” about the baseline. This family of planes is known as an epipolar pencil. All epipolar lines intersect at the epipole. (a pencil is a one parameter family)

Epipolar geometry depends only on the relative pose (position and orientation) and internal parameters of the two cameras, i.e. the position of the camera centres and image planes. It does not depend on the scene structure (3D points external to the camera).

Page 13: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

13

Epipolar geometry example I: converging cameras

Note, epipolar lines are in general not parallel

e e /

Epipolar geometry example II: parallel cameras

Page 14: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

14

Algebraic representation of epipolar geometry

We know that the epipolar geometry defines a mapping

x l/

point in first image

epipolar line in second image

P

Derivation of the algebraic expression

Outline

Step 1: for a point x in the first image back project a ray with camera P

Step 2: choose two points on the ray and project into the second image with camera P/

Step 3: compute the line through the two image points using the relation l/ = p x q

P/

Page 15: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

15

• choose camera matrices

internal calibration rotation translation

from world to camera coordinate frame

• first camera

world coordinate frame aligned with first camera

• second camera

Step 1: for a point x in the first image back project a ray with camera

P

A point x back projects to a ray

where Z is the point’s depth, since

satisfies

Page 16: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

16

Step 2: choose two points on the ray and project into the second image with camera P/

P/

Consider two points on the ray

• Z = 0 is the camera centre

• Z = is the point at infinity

Project these two points into the second view

Compute the line through the points

F is the fundamental matrix

F

Step 3: compute the line through the two image points using the relation l/ = p x q

Using the identity

Page 17: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

17

The fundamental matrix F

F is the unique 3x3 rank 2 matrix that satisfies x’TFx=0 for all x↔x’

(i) Epipolar lines: l’=Fx & l=FTx’

(ii) Epipoles: on all epipolar lines, thus e’TFx=0, x e’TF=0, similarly Fe=0

(iii) F has 7 d.o.f. , i.e. 3x3-1(homogeneous)-1(rank2)

(iv) F is a correlation, projective mapping from a point x to a line l’=Fx (not a proper correlation, i.e. not invertible)

Example I: compute the fundamental matrix for a parallel camera stereo rig

• reduces to y = y/ , i.e. raster correspondence (horizontal scan-lines)

f

f

X YZ

= tx/f (but we are in homogeneous space)

Page 18: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

18

f

f

X YZ

Geometric interpretation ?

Example II: compute F for a forward translating camera

f

f

X YZ

= tz/f (but we are in homogeneous space)

Page 19: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

19

f

f

X YZ

first image second image

Summary: Properties of the Fundamental matrix

Page 20: Lec6 EpipolarGeo V1.ppt [Kompatibilitätsmodus] · PDF fileEpipolar geometry depends only on the relative pose ... back project a ray with camera P ... from world to camera coordinate

20

THANK YOU!