Skip to content

Epipolar Geometry, Homographies, and Two-View Verification

Epipolar Geometry, Homographies, and Two-View Verification curated visual

Visual: two-view verification diagram showing matched pixels, epipolar lines, fundamental and essential matrix routing, plane-induced homography, inlier masks, and degeneracy diagnostics.

Cameras convert 3D structure into 2D rays. Epipolar geometry and homographies are the first tests that decide whether two images agree about the same scene before a stack trusts visual odometry, stereo validation, loop closure, camera calibration QA, or map-image alignment.

This page is the two-view model-selection layer that sits next to Camera Projective Geometry, PnP, and Triangulation. PnP uses 3D-to-2D correspondences and triangulation estimates 3D points from known poses; two-view epipolar and homography models instead start with 2D-to-2D matches and ask which camera-motion or planar-scene hypothesis is defensible.



2. Why It Matters for AV, Perception, SLAM, and Mapping

WorkflowTwo-view roleAV risk if wrong
Visual odometry initializationEstimate relative rotation/translation direction from matched image points.A low-parallax or planar pair can produce plausible but wrong scale, direction, or pose candidates.
Stereo validationCheck whether matches lie on the expected epipolar lines before triangulation.False stereo matches create depth spikes that contaminate obstacles, maps, or calibration labels.
Loop closure verificationReject appearance-only matches that fail geometric consistency.A false loop can bend a map or localize the vehicle to a visually similar but wrong area.
Camera calibration QAUse residual patterns to detect bad intrinsics, distortion, rolling-shutter timing, or extrinsics.Calibration drift looks like perception noise until projected boxes and features are systematically shifted.
Map-image alignmentUse homographies for planar signs, ground patches, dock markings, or calibration boards.A homography fitted outside planar assumptions can make a non-flat scene appear aligned.
Learned geometry sanity checksCompare neural correspondence, depth, or pointmap outputs against classic two-view constraints.A learned model may be confident on texture or domain shift where rigid geometry says the match set is inconsistent.

3. Inputs, Outputs, and Model Choice

3.1 Inputs

InputContract
Matched pixelsPairs x1_i <-> x2_i with match scores, descriptor/source IDs, and image pyramid scale.
Camera intrinsicsK1, K2, distortion model, image size, and whether pixels have already been undistorted.
TimingExposure midpoint, frame timestamps, rolling-shutter model, and vehicle motion context if available.
Match provenanceFeature matcher, learned correspondence model, optical flow, fiducial detector, or semantic landmark source.
Prior constraintsStereo rig baseline, expected vehicle motion, IMU yaw/roll/pitch prior, planar target metadata, or map plane.

3.2 Outputs

OutputMeaning
FFundamental matrix that maps a pixel in one image to an epipolar line in the other image.
EEssential matrix for calibrated normalized coordinates, containing relative rotation and translation direction constraints.
HHomography that maps points between views when the scene is planar or the camera motion is pure rotation.
Inlier maskThe subset of matches that satisfy the selected residual and threshold.
Relative-pose candidatesCandidate (R, t direction) solutions from E, filtered by cheirality and priors.
Plane hypothesisCandidate plane normal and translation relation from H, if decomposition is used.
DiagnosticsInlier ratio, residual distribution, parallax, spatial support, model competition, and degeneracy flags.

3.3 Model Choice

ModelMinimal dataBest fitCaveat
Fundamental matrix F7 or 8 uncalibrated point pairs.Pixel-space epipolar verification when intrinsics are unknown or not trusted.Does not directly give metric relative pose without calibration.
Essential matrix E5 or more calibrated normalized point pairs.Relative pose for calibrated camera pairs and visual odometry.Translation scale is unobservable from two monocular views.
Homography H4 point pairs.Planar targets, road/ground patches, signs, image stabilization, pure rotation, and map-image alignment.Can win incorrectly in mostly planar or low-parallax scenes.
PnP3D-to-2D correspondences.Pose against a known map, marker, board, or landmark set.Different problem: it requires 3D anchors rather than only two image views.
TriangulationTwo or more views with known poses.Landmark depth after the pose/model has been accepted.Depth is unstable under small baseline or bad correspondence geometry.

4. Core Geometry

4.1 Epipolar Constraint

For a 3D point observed as homogeneous pixels x1 and x2, the fundamental matrix enforces:

text
x2^T F x1 = 0
l2 = F x1
l1 = F^T x2

l2 is the epipolar line in image 2 corresponding to point x1; l1 is the corresponding line in image 1. The geometric test is not whether the two pixels are close in image coordinates, but whether each pixel is close to the line predicted by the other view.

4.2 Essential Matrix

With calibrated normalized image points:

text
x_norm = K^-1 x
x2_norm^T E x1_norm = 0
E = [t]_x R

The essential matrix constrains the relative rotation R and translation direction t between cameras. Decomposition produces multiple pose candidates; the physically valid candidate must put triangulated points in front of both cameras.

Two-view monocular geometry does not recover absolute translation scale. Scale must come from stereo baseline, IMU/wheel/GNSS integration, known object size, map priors, or later bundle adjustment with metric constraints.

4.3 Fundamental Matrix

When intrinsics are known:

text
F = K2^-T E K1^-1

The fundamental matrix is useful for pixel-space verification, legacy cameras, or cases where the geometric check should happen before normalized camera coordinates are trusted. It also exposes calibration problems: a strong F fit with poor E fit can indicate bad intrinsics, distortion handling, or inconsistent camera metadata.

4.4 Homography

A homography maps points on a common plane between views:

text
x2 ~ H x1
H ~ K2 (R - t n^T / d) K1^-1

where n is the plane normal and d is its distance in camera-1 coordinates. For pure rotation, the plane term drops out and:

text
H ~ K2 R K1^-1

This is why homographies are valid for calibration boards, planar signs, floor/road patches under local flatness assumptions, image stitching, and camera rotation. They are not a general 3D scene model.

4.5 Residuals and Robust Estimation

Common residual choices:

ResidualTypical useNotes
Point-to-epipolar-line distanceFast F or E scoring.Needs normalization so thresholds map to pixel noise.
Sampson distanceFundamental-matrix scoring.First-order approximation to geometric reprojection error.
Symmetric epipolar distanceF/E verification.Scores both image directions.
Reprojection distanceHomography, PnP, and triangulation refinement.Easier to map to pixel thresholds but model-specific.
Symmetric homography transfer errorPlanar image-to-image checks.Evaluates forward and inverse mapping consistency.

Use RANSAC, USAC, LMedS, MAGSAC-style variants, or a documented robust estimator because feature matching and learned correspondence proposals often contain many outliers. The robust threshold is a release parameter, not a magic constant: it should be tied to keypoint precision, undistortion quality, image scale, rolling-shutter motion, and downstream risk.


5. Algorithm Steps

5.1 Two-View Geometric Verification

  1. Gather candidate matches with pixel coordinates, image IDs, timestamps, scale, and match confidence.
  2. Undistort or normalize points exactly once; record whether thresholds are in pixels or normalized units.
  3. Fit F, E, and/or H inside a robust estimator with deterministic seed policy for regression tests.
  4. Compare model support: inlier count, residual quantiles, spatial coverage, parallax, and whether inliers collapse to a plane or repeated texture region.
  5. Decompose E only after the calibrated model is credible; apply cheirality and vehicle-motion priors.
  6. Decompose or use H only when planar or pure-rotation assumptions are expected and documented.
  7. Refine accepted models with all inliers and report residual distributions, not only the final matrix.
  8. Hand accepted constraints to PnP, triangulation, bundle adjustment, loop closure, or calibration QA with provenance and failure flags preserved.

5.2 Relative-Pose Initialization

  1. Start with calibrated image points.
  2. Estimate E robustly using a five-point or nonminimal solver.
  3. Recover pose candidates and triangulate a small inlier subset.
  4. Select the pose with maximum positive-depth support and plausible vehicle motion.
  5. Reject the pair if parallax is too low, inliers are spatially clustered, or the homography score is equally strong in a planar scene.
  6. Pass the result to bundle adjustment or a visual-inertial estimator as an initialization, not as final ground truth.

5.3 Homography Verification

  1. Fit H from four or more point pairs under RANSAC/USAC.
  2. Score forward and inverse reprojection error in pixels.
  3. Check whether the inlier set lies on a known plane, marker, sign, floor, dock line, or local ground patch.
  4. Reject H for general 3D scene alignment unless the application explicitly expects pure rotation or a planar approximation.
  5. If decomposed, validate candidate rotations, translations, and plane normals against calibration, IMU, map, or target metadata.

6. Assumptions and Domain Fit

DomainGood fitTransfer caveats
Road AVs and robotaxisStereo validation, visual odometry, lane/sign/map alignment, loop closure, and learned-depth checks.Dynamic traffic, rolling shutter, glare, rain, and long forward-motion segments create low-parallax or outlier-heavy pairs.
Airside autonomyApron marking alignment, dock/stand fiducials, calibration boards, visual QA around aircraft/GSE, and loop-closure rejection.Texture-poor pavement, wide open spaces, de-icing mist, jet blast shimmer, and repeated markings can make homography support misleading.
Warehouses and logistics yardsFiducials, rack/door plane alignment, trailer-dock markings, and low-speed stereo checks.Repeated shelf or container patterns need semantic and spatial support checks, not only inlier count.
Ports, mines, construction, agricultureVisual-inertial initialization, machine-marker alignment, surveyed target checks, and map-image QA.Dust, mud, vegetation, vibration, and temporary layouts increase outliers and violate static-scene assumptions.
Delivery robots and outdoor campusesLow-cost camera odometry, curb/ground-plane checks, visual loop verification, and crosswalk/sign alignment.Pedestrians, close objects, low camera height, fisheye lenses, and rolling shutter require careful distortion and timing treatment.

7. Failure Modes and Diagnostics

SymptomLikely causeDiagnostic
Many inliers but wrong relative pose.Planar scene, repeated texture, or low parallax lets a bad model dominate.Compare E versus H support, plot inlier spatial coverage, and check triangulation angles.
Essential-matrix pose flips or jumps.Cheirality ambiguity, near-pure rotation, or noisy correspondences.Count positive-depth points for each candidate and gate against IMU/vehicle-motion priors.
Fundamental matrix fits but essential matrix does not.Bad intrinsics, distortion mismatch, resized images with stale K, or mixed camera metadata.Re-run with undistorted normalized points and audit calibration provenance.
Homography works on a road patch but fails on obstacles.The scene is not planar even if the ground is locally flat.Visualize residuals by semantic class and reject off-plane points before using H.
Epipolar residual grows by image row.Rolling shutter, exposure timing, or ego-motion interpolation error.Plot residual versus row and angular velocity; compare global-shutter or deskewed samples.
Inliers cluster in one corner.Feature matcher found one textured patch, not scene-wide support.Require spatial bins, semantic diversity, or minimum baseline support.
RANSAC is flaky across runs.Random seed, parallel robust-estimation policy, or unstable match ordering.Fix deterministic seeds for regression tests and sort matches by stable keys.
Visual loop closure passes on similar places.Appearance descriptors found a repeated structure and geometry did not have enough parallax.Require multi-hypothesis scoring, map priors, temporal consistency, or independent sensor confirmation.

8. Implementation Notes

  • Keep point units explicit. findFundamentalMat thresholds are usually in pixels; essential-matrix thresholds can be pixels or normalized units depending on API overload and camera-matrix handling.
  • Do not estimate ideal pinhole two-view geometry on raw distorted pixels unless the API explicitly handles the distortion model.
  • Normalize coordinates for numerical conditioning, especially for eight-point fundamental-matrix estimation.
  • Prefer calibrated E for relative-pose initialization when intrinsics are reliable; prefer F for pixel-space verification or calibration debugging.
  • Treat H as a planar or pure-rotation model. A high homography inlier count in road, apron, or warehouse imagery is a degeneracy warning for general 3D motion.
  • Report more than one scalar: inlier count, inlier ratio, residual quantiles, parallax/triangulation angle, model competition, and spatial support are all needed for release review.
  • Use held-out matches or later bundle-adjustment residuals to detect overfitting a robust estimator to repeated texture.
  • Preserve match provenance and inlier masks in logs. Debugging a false loop or calibration drift requires knowing which features created the accepted model.
  • For learned feature or correspondence systems, keep a classic geometric verification stage unless the learned model is explicitly trained and validated to replace it under the target ODD.

9. AV Release Evidence

Two-view geometry should appear in release evidence as a diagnostic gate, not only as math inside a visual front end:

  • Calibration release: residual maps before and after intrinsics/extrinsics updates, with F/E/H consistency checks on held-out scenes.
  • Visual-odometry release: failed-pair taxonomy for low parallax, planar scenes, rolling shutter, repeated texture, and dynamic objects.
  • Loop-closure release: appearance-only candidates rejected by geometric verification, plus accepted candidates reviewed by residual and map-impact tests.
  • Dataset release: flags for sequences where public-road, warehouse, yard, port, mine, farm, campus, or airside imagery violates assumptions through weather, texture, rolling shutter, or dynamic-scene dominance.
  • Runtime monitoring: counters for inlier ratio, residual quantiles, model selection, cheirality failure, parallax, and deterministic robust-estimator status.

10. Sources

Public research notes collected from public sources.