Fundamental matrix estimation

This documentation was generated with the assistance of AI. Please report any inaccuracies.

The fundamental matrix is a , rank-2 matrix that encodes the epipolar geometry between a pair of uncalibrated views: it is the only piece of information needed to constrain where a point in one image can match in the other, without knowing anything about the cameras' intrinsic parameters.

Epipolar geometry between two views

Given a 3D world point , its projections and on the left and right views, the camera centers , and always define a plane — the epipolar plane . Its intersection with each image plane is an epipolar line ( on the left view, on the right), and the projection of one camera’s center onto the other view is that view’s epipole ( , ). As varies, every epipolar plane still contains the baseline , so all epipolar lines in a view pass through that view’s epipole — a pencil of lines:

Pencil of epipolar planes and lines

The epipolar constraint

Because lies on epipolar line and passes through epipole , , where is the skew-symmetric cross-product matrix of . Back-projecting epipolar lines to the (shared) epipolar plane and forward-projecting to the other view yields the linear map

so any matched pair must satisfy the epipolar constraint

is defined up to scale (8 DOF from ) and, since and , its left/right null-spaces are exactly the two epipoles — forcing and leaving 7 true degrees of freedom. Given the SVD , the epipoles are recovered directly as the singular vectors of the zero singular value: (last column of ), (last column of ) Irurueta, PhD thesis §3.2.1 (FundamentalMatrix.computeEpipoles(), getLeftEpipole()/getRightEpipole()). When the pair of cameras , is already known, new FundamentalMatrix(leftCamera, rightCamera) computes directly from .

Linear estimation and the 8-point algorithm

Expanding the constraint for inhomogeneous coordinates gives one linear equation per correspondence in the 9 unknowns of stacked as a vector :

With 8 or more correspondences, is the right singular vector of for its smallest singular value (exact null-space for exactly 8 points, LMSE fit for more). The resulting matrix is not guaranteed to have rank 2, so the 8-point algorithm enforces it by zeroing the smallest singular value of 's own SVD: if , the closest rank-2 matrix in Frobenius norm is . Point coordinates are normalized beforehand (centroid at the origin, RMS distance ) to keep the linear system well conditioned Irurueta, PhD thesis §3.2.2.1, matching the normalized-DLT practice in Hartley & Zisserman Hartley & Zisserman, 2003 §11.2.

Maps to com.irurueta.ar.epipolar.estimators.EightPointsFundamentalMatrixEstimator (setPointsNormalized toggles normalization).

The 7-point algorithm

Seven correspondences make a matrix whose null-space has dimension 2, spanned by and (the two smallest-singular-value right singular vectors). The true is some combination ; enforcing the rank-2 constraint gives a cubic in whose real root(s) are found via the companion-matrix/eigenvalue technique. One real root means a unique, non-degenerate solution; three distinct real roots signal a geometrically degenerate configuration (e.g. all points near-coplanar, or the two camera centers too close together) Irurueta, PhD thesis §3.2.2.2.

Maps to SevenPointsFundamentalMatrixEstimator (estimateAll() returns every real solution; estimate() picks the single valid one).

Two additional non-robust variants exist for restricted motions: AffineFundamentalMatrixEstimator (for affine cameras) and PlanarFundamentalMatrixEstimator (when all points lie on a common plane, using the plane-induced homography relation ).

Robust estimation

With many, possibly mismatched correspondences, a robust wrapper repeatedly draws a minimal sample (7 or 8 points), fits with the corresponding non-robust estimator, and scores the fit by the epipolar distance of every correspondence to its generated epipolar line:

This is exactly the two-tier pattern described in Robust vs. non-robust estimation: pick FundamentalMatrixEstimatorMethod.SEVEN_POINTS_ALGORITHM or EIGHT_POINTS_ALGORITHM as the inner non-robust solver, and RobustEstimatorMethod.{RANSAC,LMEDS,MSAC,PROSAC,PROMEDS} as the outlier-rejection strategy. A threshold of 1-2 pixels on works well in practice Irurueta, PhD thesis §3.2.3.

Maps to {RANSAC,LMedS,MSAC,PROSAC,PROMedS}FundamentalMatrixRobustEstimator, all subclasses of the abstract FundamentalMatrixRobustEstimator (factory: FundamentalMatrixRobustEstimator.create(…​)).

Example

// Exact 7-point solve (7 correspondences)
var sevenPoint = new SevenPointsFundamentalMatrixEstimator(leftPoints, rightPoints);
List<FundamentalMatrix> candidates = sevenPoint.estimateAll(); // 1 or 3 real solutions

// Robust estimation over many (possibly wrong) correspondences
var ransac = (RANSACFundamentalMatrixRobustEstimator) FundamentalMatrixRobustEstimator.create(
        leftPoints, rightPoints, RobustEstimatorMethod.RANSAC);
ransac.setThreshold(1.0); // pixels of epipolar distance
FundamentalMatrix fundamentalMatrix = ransac.estimate();

Point2D leftEpipole = fundamentalMatrix.getLeftEpipole();
Point2D rightEpipole = fundamentalMatrix.getRightEpipole();

Key classes

Class Repository Javadoc

FundamentalMatrix

Source

Javadoc

SevenPointsFundamentalMatrixEstimator

Source

Javadoc

FundamentalMatrixRobustEstimator

Source

Javadoc

RANSACFundamentalMatrixRobustEstimator

Source

Javadoc

Next

Essential matrix shows how combines with known intrinsic calibration to give the essential matrix and an initial metric camera pair; Point correction shows how to correct noisy correspondences so they lie exactly on the epipolar geometry before triangulating them.