One equation per correspondence
Corresponding points and satisfy the epipolar constraint . Written out, this is a linear equation in the nine entries of :
Each of the correspondences adds one row to a homogeneous system:
has 9 entries but is only defined up to scale, which leaves 8 unknowns. So at least 8 correspondences are needed, with linearly independent rows. With more points and noise there is no exact solution, and the unit vector that makes smallest is the right singular vector of the smallest singular value, the last column of in the SVD . This is the same step as for a homography and for the projection matrix in DLT calibration.
Normalize the coordinates first
In pixel coordinates the columns of have very different sizes: is around , while the last column is 1. The least-squares solution minimizes an algebraic error in which the large terms dominate, and the small singular values of that decide the solution get lost next to the large ones. The result is very sensitive to noise.
The fix is to change the coordinate system of each image before building : move the origin to the centroid of the points and scale them so that their mean distance from it is . Coordinates are then of the order of 1:
The 8-point algorithm on gives . Since , the matrix for the pixel coordinates is .
Enforce rank 2
A true fundamental matrix is singular, it has rank 2, and all epipolar lines of an image meet in the epipole. The solution of does not know this, and with noise it comes out with full rank: its epipolar lines no longer pass through a common point. The repair takes the SVD of the estimate, sets the smallest singular value to zero and multiplies it back together:
This is the rank-2 matrix closest to the estimate in the Frobenius norm, the rank approximation of the SVD. It is applied to before the normalization is undone.
Algebraic and geometric error
The 8-point algorithm minimizes , an algebraic quantity without a direct meaning in the image. The panel measures the error that matters: the distance in pixels of each from its epipolar line , for the points used and for other points that played no part in the estimate. Like linear calibration, the 8-point algorithm is fast and needs no initial guess, and its result is usually refined by a non-linear method that minimizes a geometric error.
Try this
- Set the noise to 0 and the points to 8: , equals , and the estimated lines cover the true ones.
- Set the noise back to 1 px and turn normalization off. The column sizes of range over five orders of magnitude, jumps, and the error on the other points grows several times.
- Without normalization, compare enforce rank 2 on and off: forcing rank 2 in pixel coordinates makes the error even larger. With normalization it hardly costs anything.
- Turn off enforce rank 2 and zoom out until you reach an epipole: the epipolar lines no longer meet in one point but cross in a cloud. The panel shows .
- Increase the number of points with 1 px noise: the error on the other points shrinks, while the error on the used points stays near the noise level.
- Press New noise a few times with only 8 points: the estimated epipoles jump around. Exactly determined systems fit the noise perfectly, and more points average it out.