27.02.2014 Views

EPIPOLAR GEOMETRY

EPIPOLAR GEOMETRY

EPIPOLAR GEOMETRY

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>EPIPOLAR</strong> <strong>GEOMETRY</strong><br />

The slides are from several sources through James Hays (Brown);<br />

Silvio Savarese (U. of Michigan); Svetlana Lazebnik (U. Illinois);<br />

Bill Freeman and Antonio Torralba (MIT), including their own slides.


Recovering structure from a single view<br />

Pinhole perspective projection<br />

P<br />

p<br />

O w<br />

Calibration rig<br />

Scene<br />

C<br />

Camera K<br />

Why is it so difficult?<br />

Intrinsic ambiguity of the mapping from 3D to image in 2D.<br />

see example...


Is this an illusion of 3D to 2D?<br />

Courtesy slide S. Lazebnik


Why multiple views?<br />

• Structure and depth are inherently ambiguous from<br />

single views.<br />

P1<br />

P2<br />

P1’=P2’<br />

Optical center


Epipolar constraint<br />

Geometry of two views constrains where the corresponding<br />

pixel for some image point in the first view must occur<br />

in the second view.<br />

It must be carved out by a plane connecting the<br />

world point and the optical centers.


Epipolar geometry<br />

Epipolar Line<br />

Epipolar Line<br />

• Epipolar Plane<br />

Epipole<br />

Baseline<br />

Epipole


Epipolar geometry: terms<br />

• Baseline: line joining the camera centers.<br />

• Epipole: point of intersection of baseline with image plane.<br />

• Epipolar plane: plane containing baseline and world point.<br />

• Epipolar line: intersection of epipolar plane with the image<br />

plane.<br />

• All epipolar lines in an image intersect at the epipole... or,<br />

an epipolar plane intersects the left and right image planes<br />

in epipolar lines.<br />

Why is the epipolar constraint useful?


Epipolar constraint<br />

Reduces the correspondence problem to a 1D search<br />

in the second image along an epipolar line.<br />

Image from Andrew Zisserman


Two examples:<br />

Slide credit: Kristen Grauman


Converging cameras have finite epipoles.<br />

Figure from Hartley & Zisserman


Parallel cameras have epipoles at infinity.<br />

X<br />

at infinity<br />

e<br />

1<br />

x 1 x 2<br />

at infinity<br />

e 2<br />

O 1<br />

O 2<br />

• Baseline intersects the image plane at infinity.<br />

• Epipoles are at infinity.<br />

• Epipolar lines are parallel to x axis.


In parallel cameras search is only along x coord.<br />

Figure from Hartley & Zisserman<br />

Slide credit: Kristen Grauman


Motion perpendicular to image plane


Motion perpendicular to image plane<br />

forward


Forward translation<br />

second<br />

first<br />

e 2<br />

O 2<br />

O 1<br />

• The epipoles have same position in both images.<br />

• Epipole here is called FOE (focus of expansion).


A 3x3 matrix connects the two 2D images.<br />

This matrix is called<br />

• the “Essential Matrix”, E<br />

– when image intrinsic parameters are known<br />

• the “Fundamental Matrix”, F<br />

– more the general uncalibrated case


Essential matrix: E<br />

x<br />

T<br />

E x = l<br />

2<br />

- Two views of the same object<br />

- Suppose we know the camera positions and camera matrices ==> E matrix<br />

- Given a point on left image, how can we find the corresponding point on right image?


Epipolar Constraint - E matrix<br />

P<br />

p<br />

p’<br />

O<br />

R, T<br />

O’<br />

<br />

M K I<br />

0<br />

M'<br />

<br />

<br />

'<br />

K R<br />

T<br />

P<br />

<br />

M P<br />

<br />

u<br />

<br />

<br />

v<br />

<br />

<br />

1<br />

homogeous coordinates<br />

P<br />

<br />

M<br />

P<br />

<br />

u<br />

<br />

<br />

v<br />

<br />

<br />

1


P<br />

p<br />

p’<br />

O<br />

R, T<br />

O’<br />

<br />

M K I<br />

0<br />

'<br />

K and K are known<br />

(calibrated cameras)<br />

M'<br />

<br />

'<br />

<br />

K R<br />

T<br />

M I<br />

0<br />

M ' R<br />

T


In the epipolar plane we have<br />

P<br />

p<br />

p’<br />

O<br />

R, T<br />

O’<br />

T<br />

<br />

( R p )<br />

Perpendicular to epipolar plane<br />

first camera coordinates<br />

p T<br />

<br />

T<br />

(R p )<br />

<br />

0


Cross products can be written as matrix multiplication.<br />

...verify it<br />

The matrix derived from a is skew-symmetric.<br />

The matrix is rank 2. The null vector is along the vector a.


T<br />

E is from p' to p<br />

T T<br />

p' E p = 0<br />

Essential matrix<br />

P<br />

some denote E as<br />

from image 2 to 1<br />

second camera<br />

coordinate<br />

p<br />

p’<br />

then R and t are<br />

from image 1 to 2<br />

O<br />

R, T<br />

O’<br />

p T<br />

T<br />

(R p )<br />

<br />

0 p T T<br />

R p<br />

0<br />

X<br />

E is a rank 2 matrix!<br />

E = essential matrix<br />

(Longuet-Higgins, 1981)


Essential matrix properties<br />

X<br />

(x_1) E x_2 = 0<br />

calibrated<br />

x 2<br />

l 1 l 2<br />

x 1<br />

e 1<br />

e 2<br />

T<br />

O 1<br />

O 2<br />

• E x 2 is the epipolar line associated with x 2 (l 1 = E x 2 )<br />

• E T x 1 is the epipolar line associated with x 1 (l 2 = E T x 1 )<br />

• E is singular (rank two) -- two equal singular values are one.<br />

• E e 2 = 0 and E T e 1 = 0<br />

l e = (E x ) e = 0 valid for any x<br />

• E is 3x3 matrix with 5 DOF: 3(R) + 3(t) -1(scale)<br />

T<br />

1<br />

T<br />

1 2 1<br />

2


Fundamental matrix: F<br />

x<br />

l’ = F T x<br />

- Uncalibrated cameras.<br />

- No additional information about the scene and camera is given ==> F matrix<br />

- Given a point on left image, how can I find the corresponding point on right image?


uncalibrated camera<br />

Epipolar Constraint - F matrix<br />

P<br />

uncalibrated camera<br />

M' = K'[R t]<br />

M<br />

p<br />

R t<br />

p’<br />

O<br />

O’<br />

P M P<br />

<br />

u<br />

p M KI<br />

0<br />

v<br />

<br />

1 homogeous coord.<br />

unknown<br />

(3x4)


F matrix derived from E matrix<br />

p<br />

<br />

K<br />

1<br />

p<br />

P<br />

p<br />

<br />

K<br />

1<br />

'<br />

p<br />

p<br />

p’<br />

O<br />

O’<br />

[T] !!<br />

x<br />

p T<br />

<br />

T<br />

R p<br />

0<br />

<br />

<br />

(K<br />

1<br />

p)<br />

T<br />

<br />

<br />

1<br />

T R K<br />

p<br />

0<br />

<br />

p<br />

T<br />

K<br />

T<br />

<br />

1<br />

T R K<br />

p<br />

<br />

0 p T F p 0<br />

<br />

rank 2


T<br />

F is from p' to p<br />

T T<br />

p' F p = 0<br />

second camera<br />

coordinate<br />

Fundamental matrix<br />

P<br />

some denote F as<br />

from image 2 to 1<br />

p<br />

R t<br />

p’<br />

then R and t are<br />

from image 1 to 2<br />

O<br />

O’<br />

p T<br />

F p<br />

(Faugeras and Luong, 1992)<br />

<br />

0<br />

The fundamental matrix has a projective ambiguity. Two pairs<br />

~ ~<br />

of camera matrices (P, P') and (P, P') give the same F if<br />

~ ~<br />

P = PH and P' = P'H where H is a 4x4 nonsingular matrix.


Fundamental matrix properties<br />

fundamental matrix<br />

is much more used<br />

X<br />

T<br />

(x_1) F x_2 = 0<br />

uncalibrated<br />

x 1<br />

e 1<br />

e 2<br />

x 2<br />

O 1<br />

O 2<br />

• F x 2 is the epipolar line associated with x 2 (l 1 = F x 2 )<br />

• F T x 1 is the epipolar line associated with x 1 (l 2 = F T x 1 )<br />

• F is singular (rank two)<br />

• F e 2 = 0 and F T e 1 = 0<br />

• F is 3x3 matrix with 7 DOF: 9 - 1(rank 2) - 1(scale)


The eight-point algorithm of F (linear)<br />

(Hartley, 1995)<br />

x = (u, v, 1) T , x’ = (u’, v’, 1) T<br />

Minimize:<br />

N<br />

∑ ( x<br />

T ′<br />

i<br />

F xi<br />

)<br />

2<br />

i=<br />

1<br />

under the constraint<br />

F 33 = 1<br />

can be an other F_ij constraint also


Estimating F<br />

W<br />

• Homogeneous system<br />

• Rank 8<br />

• If N>8<br />

Wf<br />

0<br />

A non-zero solution exists (unique)<br />

Lsq. solution by SVD<br />

f 1<br />

rank 3 solution<br />

Fˆ<br />

f


Taking into account the rank-2 constraint.<br />

p T<br />

Fˆ<br />

p<br />

<br />

0<br />

^<br />

The estimated F have full rank (det(F) ≠0)<br />

but F should have rank=2 instead.<br />

^<br />

Find F that minimizes<br />

F<br />

<br />

Fˆ<br />

<br />

0<br />

Frobenius norm (*)<br />

subject to det(F)=0<br />

Taking the first two s.v. and the three equal zero.<br />

(*) Sqrt root of the sum of squares of all entries


Example of F recovery<br />

Data courtesy of R. Mohr and B. Boufama.


This are large errors...<br />

Mean errors:<br />

10.0pixel<br />

and 9.1pixel


The problem with eight-point algorithm<br />

Poor numerical conditioning.<br />

Can be fixed by rescaling the data before estimation.<br />

Can be used for any DLT type algorithm.<br />

More sophisticated nonlinear methods after the 8-point algorithm<br />

exist, but we will not cover.


RESCALING BY NORMALIZATION<br />

You have i = 1, . . . , n points x i .<br />

points is<br />

¯x = 1 n∑<br />

x i<br />

n<br />

i=1<br />

The mean of these<br />

which is translated to the origin (0, 0) by the vector −¯x.<br />

The new coordinated of a point are ˜x i = x i − ¯x.<br />

Compute the mean squared distance of the points from<br />

the center<br />

a 2 = 1 n∑<br />

˜x ⊤ i<br />

n ˜x i<br />

i=1<br />

and move the square norm equal to 2 by multiplying the<br />

components of the original point √ 2/a. This is the scaling.<br />

The translation are the mean coordinates with opposite<br />

sign multiplied with √ 2/a.<br />

In the homogeneous 2D coordinates<br />

⎡ ⎤<br />

√ 1 0 −¯x 2 1<br />

T = ⎣ 0 1 −¯x 2 ⎦ Tx i =<br />

a a<br />

0 0 √2<br />

a 2D similarity transformation.<br />

⎡<br />

⎢<br />

⎣<br />

√<br />

2<br />

a (x i1 − ¯x 1 )<br />

√<br />

2<br />

a (x i2 − ¯x 2 )<br />

1<br />

⎤<br />

⎥<br />


The normalized eight-point algorithm<br />

(Hartley, 1995)<br />

• Center the image data at the origin, and scale it so<br />

the mean squared distance between the origin and<br />

the data points is 2 pixels.<br />

• Use the eight-point algorithm to compute F from the<br />

normalized points, n_1 and n_2.<br />

• Enforce the rank-2 constraint. For example, take SVD<br />

of F and throw out the smallest singular value.<br />

• Transform fundamental matrix back to original units:<br />

if T and T’ are the normalizing transformations in the<br />

two images, than the fundamental matrix in original<br />

coordinates is T T F T’.<br />

Isotropic translation (mean to origin)<br />

and scale in each image separately.<br />

-1 -1<br />

x_1 = T n_1 x_2 = T' n_2<br />

T -T -1<br />

(n_1) T F T' n_2 = 0 => final F<br />

given


With transformation Without transformation<br />

Mean errors:<br />

10.0pixel<br />

and 9.1pixel<br />

Mean errors:<br />

1.0pixel<br />

and 0.9pixel


Comparison of estimation algorithms<br />

8-point Normalized 8-point Nonlinear least squares<br />

Av. Dist. 1 2.33 pixels 0.92 pixel 0.86 pixel<br />

Av. Dist. 2 2.18 pixels 0.85 pixel 0.80 pixel


From epipolar geometry to camera calibration<br />

• Estimating the fundamental matrix is known<br />

as “weak calibration”.<br />

• If we know the calibration matrices of the two<br />

cameras, we can estimate the essential<br />

matrix: E=K T FK’<br />

(see F from E slide)<br />

• The essential matrix can give us the relative<br />

rotation and translation between the cameras,<br />

with 5 point pairs.


Example: Parallel calibrated images<br />

X<br />

e<br />

1<br />

x 1 x 2<br />

t<br />

e 2<br />

y<br />

z<br />

x<br />

O 1<br />

O 2<br />

K 1 =K 2 = known Hint :<br />

E=?<br />

x parallel to O 1 O 2 R = I t = (T, 0, 0)


see cross-product<br />

as matrix, before<br />

X<br />

e<br />

1<br />

x 1 x 2<br />

e 2<br />

y<br />

z<br />

x<br />

O 1<br />

O 2<br />

0<br />

0 0 <br />

K 1 =K 2 = known<br />

x parallel to O 1 O 2<br />

E=? E [ t <br />

<br />

<br />

] R<br />

<br />

0 0 T<br />

0<br />

T 0


X<br />

e<br />

1<br />

x 1 x 2<br />

e 2<br />

y<br />

z<br />

x<br />

O 1<br />

O 2<br />

Epipolar constraint reduces to y = y’<br />

In stereo vision that will be a big help.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!