Epipolar Geometry

Epipolar geometry describes the geometric relationship between two views of the same scene. It is encoded in the fundamental matrix (for pixel coordinates) or the essential matrix (for normalized coordinates). These matrices are central to stereo vision, visual odometry, and structure from motion.

Fundamental Matrix

Problem Statement

Given: point correspondences in pixel coordinates from two views.

Find: Fundamental matrix satisfying for all correspondences.

Properties of :

  • Rank 2 (by the epipolar constraint)
  • 7 degrees of freedom (9 entries, scale ambiguity, rank constraint)
  • Maps a point in one image to its epipolar line in the other:

8-Point Algorithm

The simplest method, requiring correspondences.

Derivation: The constraint expands to:

Each correspondence gives one linear equation in the 9 entries of .

Algorithm:

  1. Normalize both point sets using Hartley normalization
  2. Build design matrix where each row is:
  3. Solve via SVD; is the last column of
  4. Enforce rank 2: Decompose and set :
  5. Denormalize:

The rank-2 enforcement is critical: without it, the epipolar lines do not intersect at a common epipole.

7-Point Algorithm

A minimal solver using exactly 7 correspondences, producing 1 or 3 candidate matrices.

Derivation: With 7 equations for 9 unknowns (modulo scale), the null space of is 2-dimensional. Let the null space basis be and . The fundamental matrix is:

for some scalar . The rank-2 constraint gives a cubic equation in :

This cubic has 1 or 3 real roots, each giving a candidate .

Essential Matrix

Problem Statement

Given: point correspondences in normalized coordinates where .

Find: Essential matrix satisfying .

Properties of :

  • where is the relative rotation and is the translation direction
  • Has exactly two equal non-zero singular values: ,
  • 5 degrees of freedom (3 rotation + 2 translation direction)

5-Point Algorithm (Nister)

The minimal solver, producing up to 10 candidate matrices.

Algorithm:

  1. Normalize both point sets using Hartley normalization
  2. Build matrix (same form as 8-point)
  3. Null space: SVD of gives a 4-dimensional null space. The essential matrix is: for unknowns , where are the null space basis vectors
  4. Polynomial constraints: The essential matrix constraint (9 equations) and (1 equation) generate polynomial equations in
  5. Action matrix: These constraints are assembled into a polynomial system solved via the eigenvalues of a action matrix
  6. Extract real solutions: Each real eigenvalue determines and thus

Up to 10 candidate essential matrices may be returned.

Decomposing into

Given , there are 4 possible decompositions:

where and is the third column of .

Chirality check: Of the 4 candidates , only one places all triangulated points in front of both cameras. This is verified by triangulating a test point and checking that in both views.

Coordinate Conventions

MatrixInput coordinatesUsage
Fundamental Pixel coordinatesWhen intrinsics are unknown
Essential Normalized coordinates ()When intrinsics are known

The relationship is: .

RANSAC

Both solvers have RANSAC wrappers for outlier rejection:

#![allow(unused)]
fn main() {
let (F, inliers) = fundamental_8point_ransac(&pts1, &pts2, &opts)?;
}

Currently, only the 8-point fundamental matrix solver has a RANSAC wrapper. The 5-point essential matrix solver (essential_5point) returns multiple candidates and is used directly.

OpenCV equivalence: cv::findFundamentalMat (8-point and 7-point), cv::findEssentialMat (5-point with RANSAC).

References

  • Nister, D. (2004). "An Efficient Solution to the Five-Point Relative Pose Problem." IEEE TPAMI, 26(6), 756-770.
  • Hartley, R.I. (1997). "In Defense of the Eight-Point Algorithm." IEEE TPAMI, 19(6), 580-593.