Epipolar Geometry
Epipolar Geometry
Many slides adapted from Derek Hoiem, Lana Lazebnik, Silvio Saverese, Steve Seitz, many figures from Hartley & Zisserman
• Epipolar geometry
– Relates cameras from two positions
Depth from Stereo
• Goal: recover depth by finding image coordinate x’ that corresponds to
x
X
X
x z
x x’
f f
x'
C Baseline C’
B
Depth from Stereo
• Goal: recover depth by finding image coordinate x’ that
corresponds to x
• Sub-Problems
1. Calibration: How do we recover the relation of the cameras (if
not already known)?
2. Correspondence: How do we search for the matching point x’?
x'
Correspondence Problem
x ?
x x’
x’
x’
x x’
x x’
a b c d
Example: Forward motion
e’
x x’
xˆ K 1 x X xˆ K 1 x X
3D scene point
Homogeneous 2d point
(3D ray towards X) 2D pixel coordinate 3D scene point in 2nd
(homogeneous) camera’s 3D coordinates
Epipolar constraint: Calibrated case
X
x x’
x x’
𝑥ො
𝑥ො ′
xˆ K 1 x X xˆ K 1 x X
x x’
xˆ [t ( R xˆ )] 0 xˆ T E xˆ 0 with E t R
Essential Matrix
(Longuet-Higgins, 1981)
Properties of the Essential matrix
X
x x’
xˆ [t ( R xˆ )] 0 xˆ T E xˆ 0 with E t R
Drop ^ below to simplify notation
ˆxT E xˆ 0
xT F x 0 with F K T E K 1
xˆ K 1 x
xˆ K 1 x
Fundamental Matrix
(Faugeras and Luong, 1992)
Properties of the Fundamental matrix
X
x x’
xT F x 0 with F K T E K 1
• F x’ = 0 is the epipolar line associated with x’
• FTx = 0 is the epipolar line associated with x
• F e’ = 0 and FTe = 0
• F is singular (rank two): det(F)=0
• F has seven degrees of freedom: 9 entries but defined up to scale, det(F)=0
Estimating the Fundamental Matrix
• 8-point algorithm
– Least squares solution using SVD on equations from 8 pairs of correspondences
– Enforce det(F)=0 constraint using SVD on F
• 7-point algorithm
– Use least squares to solve for null space (two vectors) using SVD and 7 pairs of
correspondences
– Solve for linear combination of null space vectors that satisfies det(F)=0
xT F x 0
𝑢𝑢′ 𝑓11 + 𝑢𝑣 ′ 𝑓12 + 𝑢𝑓13 + 𝑣𝑢′ 𝑓21 + 𝑣𝑣 ′ 𝑓22 + 𝑣𝑓23 + 𝑢′ 𝑓31 + 𝑣 ′ 𝑓32 + 𝑓33 = 0
𝑓11
𝑓12
𝑢1 𝑢1 ′ 𝑢1 𝑣1 ′ 𝑢1 𝑣1 𝑢1 ′ 𝑣1 𝑣1 ′ 𝑣1 𝑢1 ′ 𝑣1 ′ 1
𝑓13
A𝒇 = ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ ⋮ =0
𝑓
𝑢𝑛 𝑢𝑣′ 𝑢𝑛 𝑣𝑛 ′ 𝑢𝑛 𝑣𝑛 𝑢𝑛 ′ 𝑣𝑛 𝑣𝑛 ′ 𝑣𝑛 𝑢𝑛 ′ 𝑣𝑛 ′ 1 21
⋮
𝑓33
8-point algorithm
1. Solve a system of homogeneous linear equations
a. Write down the system of equations
b. Solve f from Af=0 using SVD
Matlab:
[U, S, V] = svd(A);
f = V(:, end);
F = reshape(f, [3 3])’;
Notes:
• Use RANSAC to deal with outliers (sample 8 points)
– How to test for outliers?
How to test for outliers?
Problem with eight-point algorithm
f11
f
12
f13
f 21
uu uv u vu vv v u v 1
f 22
f 23
f
31
f 32
Problem with eight-point algorithm
f11
f
12
f13
f 21
uu uv u vu vv v u v 1
f 22
f 23
f
31
f 32
Poor numerical conditioning
Can be fixed by rescaling the data
The normalized eight-point algorithm
(Hartley, 1995)
better RANSAC
SIFT
Deep Learning
Optical Flow
Hough Transform
Neural Networks
Essential and Fundamental Matrix
worse Dynamic Programming
In class written Quiz format
• 15 to 20 short answer or multiple choice questions
• Typically can be done in half an hour
• No calculators needed
• Closed book
• Only covers material discussed in class, not book. But the book
is still a useful resource
• Covers all material through the quiz date