Fundamental Matrix of Two Camera Views
The fundamental matrix is the 3 by 3 table that encodes how two uncalibrated cameras sit relative to each other. It turns a pixel in one image into a search line in the other, and the true match always scores zero.
Why Does This Exist?
Matching a pixel across two views by searching the whole second image is slow and ambiguous. Epipolar geometry cuts the search to one line, and the fundamental matrix is that line in algebraic form, needing no calibration data at all. It is the workhorse behind uncalibrated reconstruction: estimate from matches, then recover cameras and structure. Its calibrated sibling is the essential matrix, and the full pipeline continues in structure from motion.
Think of It Like This
Two witnesses, one lineup
Witness A says the suspect stood third from the left. Witness B, standing elsewhere, cannot reuse third from the left, but A can draw B a sight-line across the lineup room: the suspect must stand somewhere along that line. B still has to look, yet the search collapses from a room to a line.
is the written sight-line rule between two cameras. Where it stops: the line says where to look, while recognizing the right face along it remains its own matching problem.
How It Actually Works
For corresponding homogeneous pixels and , the epipolar constraint reads . Here is with rank : its left and right null spaces are the two epipoles, which is why every epipolar line passes through its epipole. Counting freedoms gives (global scale) (rank constraint) degrees of freedom, so seven point pairs determine in principle.
In practice the -point algorithm stacks one linear row per match and solves by SVD, then projects the answer onto rank by zeroing its smallest singular value. RANSAC wraps the solver to survive mismatches. With intrinsics and known, upgrades to .
Worked example
Pure translation along the axis gives with rows , , . Take :
so the epipolar line is , the horizontal line . The true match lies on it, and the constraint confirms:
A wrong match such as scores , nonzero and therefore rejected.
Code
The point of this snippet is the constraint check in standard-library-only code: it replays the worked example residual of 0.0 for the true match and -1.0 for the wrong one.
def epipolar_residual(xp, x): f = ((0.0, 0.0, 0.0), (0.0, 0.0, -1.0), (0.0, 1.0, 0.0)) line = [sum(f[r][c] * x[c] for c in range(3)) for r in range(3)] return sum(xp[r] * line[r] for r in range(3))
print(epipolar_residual((5.0, 1.0, 1.0), (2.0, 1.0, 1.0)))# -> 0.0print(epipolar_residual((5.0, 2.0, 1.0), (2.0, 1.0, 1.0)))# -> -1.0The first call lands on exactly 0.0 because sits on the line , while the second returns because misses it by one row.
Watch Out For
Estimating F from a flat scene
If every matched point lies on one plane, a homography explains all matches and becomes degenerate: the solver returns confidently with tiny residuals while the epipolar lines are fiction. The symptom is plausible RANSAC scores with absurd geometry. Test a homography first on suspiciously flat scenes, and estimate the plane map instead, as homography estimation does.
Skipping the rank-2 projection
The raw -point answer is full rank because of noise, but a true fundamental matrix has a zero singular value. Without zeroing the smallest one, epipolar lines systematically miss their matches by a few pixels and downstream triangulation inherits the bias. One SVD truncation fixes it: solve, decompose, zero, rebuild.
The Quick Version
- The fundamental matrix encodes uncalibrated two-view geometry in one rank-2 matrix.
- The epipolar constraint tests any candidate match algebraically.
- The worked check proves it: scores 0 on the line , while scores .
- has degrees of freedom: nine entries minus scale minus the rank constraint.
- The -point algorithm plus SVD rank projection is the standard estimator.
- Flat scenes make degenerate; a homography owns that case instead.