v9.1.1
Menu

Chapter 3: Epipolar Geometry & Stereo Vision

Week 3

Master the geometry that relates two views of the same scene. Learn how epipolar constraints reduce stereo matching from a 2D search to a 1D scan, how the fundamental and essential matrices encode this geometry, and how to build a complete stereo depth pipeline from rectification through disparity estimation to 3D reconstruction.

Topics
7
Demos
2
Videos
3
Min read
40

Chapter Overview

Epipolar geometry is the intrinsic projective geometry between two views of the same scene. It describes the geometric constraints that arise when two cameras observe common 3D points, regardless of the scene's content. These constraints are among the most powerful tools in computer vision: they tell us where a point visible in one image must lie in the other image, dramatically simplifying correspondence search and enabling depth estimation.

What is this chapter about? We develop the mathematical framework for two-view geometry from first principles. Starting with the epipolar constraint, we derive the fundamental matrix (uncalibrated cameras) and essential matrix (calibrated cameras), learn stereo rectification to simplify matching, explore stereo matching algorithms, and build a complete pipeline from image pairs to depth maps.

Why does this matter? Stereo vision is one of the oldest and most reliable methods for recovering 3D structure from images. It is used in autonomous driving (stereo depth cameras), robotics (obstacle avoidance), AR/VR (depth sensing), and medical imaging (endoscopic 3D reconstruction). Understanding epipolar geometry is also a prerequisite for multi-view reconstruction and SLAM.

How the topics connect: We start with the epipolar constraint to establish the geometric relationship between views. The fundamental matrix algebraically encodes this relationship for arbitrary cameras. The essential matrix specializes it for calibrated cameras and enables pose recovery. Stereo rectification transforms images to exploit epipolar geometry for efficient matching. Stereo matching algorithms compute dense correspondences, producing disparity maps that convert to depth. Finally, we assemble everything into end-to-end stereo pipelines.

Chapter Roadmap

Click any topic to jump in

Explainer videoInteractive demo
1
Epipolar Constraint

The coplanarity condition — how two views of one point constrain each other to epipolar lines.

The Epipolar Plane and Epipolar LinesEpipolesThe Epipolar Constraint Equation
Algebraic encoding

The fundamental and essential matrices

2
Fundamental Matrix

The 3x3 rank-2 matrix F that encodes epipolar geometry for uncalibrated cameras.

The 8-Point AlgorithmEnforcing the Rank-2 ConstraintProperties of the Fundamental Matrix
3
Essential Matrix

F for calibrated cameras — E = K'^T F K directly gives rotation and translation.

Relationship Between E and FDecomposing E into R and tThe 5-Point Algorithm
From geometry to matching

Rectification and correspondence search

4
Stereo Rectification

Warping images so epipolar lines become horizontal — enabling efficient 1D matching.

Why Rectification is NecessaryBouguet's Rectification AlgorithmRectification Quality Metrics
5
Stereo Matching

Block matching, SGM, and cost volumes — finding correspondences along epipolar lines.

Block Matching (BM)Semi-Global Matching (SGM)Cost Volumes and Winner-Take-All
From matches to 3D

Depth estimation and complete pipelines

6
Disparity & Depth

Disparity d = f*B/Z — converting pixel shifts to metric depth measurements.

The Disparity-to-Depth FormulaBaseline Effects on Depth RangeDepth Map Post-Processing
7
End-to-End Stereo

Classical OpenCV pipelines, deep learning stereo, and practical failure modes.

Classical OpenCV Stereo PipelineDeep Learning Stereo (RAFT-Stereo, LEAStereo)Practical Considerations and Failure Modes

Topics

7 topics in this chapter

Chapter 2 ended with a calibrated stereo rig, but it left the central question of two-view vision open. A pixel in the left image could be the image of any point along its viewing ray, so where can its partner appear in the right image? Searching every pixel of a 640 by 480 image for each of its 307,200 pixels is hopeless, and most candidates would be false matches anyway. The geometry of two cameras rescues us. The two camera centres and any scene point span a plane, and that plane cuts each image in a line, so the partner of a pixel must lie on one known line in the other image. This topic builds that idea step by step: the epipolar plane and the epipolar lines it creates, the epipoles where every epipolar line meets, and the compact algebraic form x2TFx1=0x_2^T F x_1 = 0 that packs the whole constraint into one 3 by 3 matrix. The rest of the chapter estimates that matrix, specialises it to calibrated cameras, warps images so the lines become rows, and finally turns matched rows into depth.

Definition

Epipolar geometry is the projective geometry relating two views of one scene. The camera centres and a scene point span the epipolar plane, which cuts each image in an epipolar line. Corresponding pixels x1x_1, x2x_2 satisfy x2TFx1=0x_2^T F x_1 = 0, so each point's match lies on the line Fx1F x_1, and all such lines pass through the epipole.

In this topic

  1. 1The Epipolar Plane and Epipolar Lines
  2. 2Epipoles
  3. 3The Epipolar Constraint Equation
1 of 3
The Epipolar Plane and Epipolar Lines

Given a 3D point X and two camera centers C1 and C2, the epipolar plane is the plane defined by these three points. This plane intersects each image to form an epipolar line. A point x1 in the first image projects to a 3D ray from C1. The projection of this ray into the second image is the epipolar line l2---the set of all possible locations where the 3D point could appear in the second image. Every pair of corresponding points must satisfy this constraint: x2 lies on l2, and x1 lies on l1.

Mathematical Intuition

Given cameras at C1C_1 and C2C_2 observing a 3D point XX, the epipolar plane is span(X−C1,C2−C1)\text{span}(X - C_1, C_2 - C_1). This plane intersects image 1 along the epipolar line l1l_1 and image 2 along l2l_2. The critical consequence: if x1x_1 is a point in image 1, its corresponding point x2x_2 must lie on l2=Fx1l_2 = F x_1. This reduces the matching search from the entire W×HW \times H image to a single line, a factor-of-HH speedup. All epipolar lines in one image pass through its epipole, forming a pencil of lines.

Example:

Two cameras are 1 meter apart with parallel optical axes. A 3D point at (0.5, 0, 5) is visible to both cameras. Camera 1 is at the origin and Camera 2 is at (1, 0, 0). Both have f=500 and principal point (320, 240). Where are the epipolar lines?

2 of 3
Epipoles

The epipole e1e_1 is the projection of camera C2C_2's center onto camera 1's image plane, and vice versa for e2e_2. All epipolar lines in one image pass through its epipole. When cameras are parallel, the epipoles are at infinity (epipolar lines are parallel horizontal lines). When one camera can see the other camera, the epipole is at a finite image location. The epipoles encode the direction of the baseline between cameras as seen from each camera's perspective.

Mathematical Intuition

The epipole e1e_1 in image 1 is the projection of C2C_2: e1=P1C2e_1 = P_1 C_2. Since Fe1=0F e_1 = 0 and FTe2=0F^T e_2 = 0, the epipoles are the left and right null vectors of FF. When cameras have parallel optical axes (common in stereo), the epipoles are at infinity (±1,0,0)T(\pm 1, 0, 0)^T and all epipolar lines are horizontal. The baseline direction in each image is encoded by the epipole: if e1=(eu,ev,1)e_1 = (e_u, e_v, 1), then the other camera is in the direction (eu−cx,ev−cy)/f(e_u - c_x, e_v - c_y) / f relative to the optical axis.

Example:

Camera 1 is at (0,0,0) looking along Z. Camera 2 is at (1,0,0) looking along Z. Both have K = [[500,0,320],[0,500,240],[0,0,1]]. Find the epipoles.

3 of 3
The Epipolar Constraint Equation

The epipolar constraint states that for any pair of corresponding points x1x_1 and x2x_2 (in homogeneous pixel coordinates), the product x2TFx1=0x_2^T F x_1 = 0, where FF is the 3×33 \times 3 fundamental matrix. This equation encodes the coplanarity condition: x2x_2 lies on the epipolar line Fx1Fx_1, and x1x_1 lies on FTx2F^T x_2. The fundamental matrix has rank 2 (det⁡(F)=0\det(F) = 0) and 7 degrees of freedom (a 3×33 \times 3 matrix up to scale, minus the rank constraint). It can be estimated from as few as 7 point correspondences.

Mathematical Intuition

The fundamental matrix FF encodes the epipolar geometry between two views. For corresponding points x\mathbf{x} and x′\mathbf{x}' in homogeneous pixel coordinates, the constraint x′TFx=0\mathbf{x}'^T F \mathbf{x} = 0 means x′\mathbf{x}' lies on the epipolar line FxF\mathbf{x} in the second image. FF is a 3×33 \times 3 matrix with rank 2 (det⁡(F)=0\det(F) = 0) and 7 degrees of freedom (9 entries minus 1 for scale minus 1 for the rank constraint). It can be estimated from as few as 7 point correspondences, though the 8-point algorithm is more commonly used for its simplicity.

Example:

Given FF and a point x1=(300,200,1)x_1 = (300, 200, 1) in image 1, the epipolar line in image 2 is l2=Fx1=(0.002,−0.001,0.5)l_2 = Fx_1 = (0.002, -0.001, 0.5). What is the equation of this line in image 2?