Epipolar Geometry
The Geometry of Two Views
Close one eye. Hold a finger at arm's length and look at it against a far wall. Now switch eyes. The finger jumps. The wall barely moves.
Your brain just performed a calculation that took computer vision researchers most of the twentieth century to write down. Two views of the same world are not independent: they are locked together by the rigid geometry of the camera that took them.
Given a point in one image, you do not have to search the whole second image for its twin. You only have to search a single line.
When two cameras (or two eyes) look at the same scene, the world they share leaves a fingerprint on the pair of pictures. That fingerprint is epipolar geometry: a set of constraints that say exactly where a feature seen in one view is allowed to appear in the other. It is the difference between hunting for a match across a million pixels and gliding along a single ruled line. Everything in this chapter (stereo depth, structure from motion, the way SLAM stitches a camera's path together) leans on this one idea.
Drag the point in the left image below and watch its epipolar line sweep across the right view. Look for the way the line pivots: notice that no matter where you put the point, the family of lines on the right all fan out from one fixed spot. That spot has a name, and finding it is half the battle.
Epipolar Constraint: p'ᵀ · F · p = 0 What you just saw is the epipolar constraint made visible. The match for your left-image point can be anywhere along that right-image line, but it cannot be off it. A two-dimensional search just collapsed into a one-dimensional one. The fan-out point is the epipole: the image of the other camera, seen from this one.
The whole relationship is captured by a single small matrix and a single tidy equation. If is a point in the left image and is its match in the right (both written in homogeneous coordinates, so a pixel becomes the column ), then
Here is the fundamental matrix, a array of numbers. The symbol is the homogeneous pixel in the first image; is the candidate match in the second; the superscript means "transpose" (turn the column into a row so the multiplication lines up); and the right-hand side being exactly is the constraint itself. The product is not a number, it is a line: the epipolar line in the right image that must lie on. The equation simply says "the matching point sits on its line."
The epipole, the baseline, and why a line appears
Picture the two optical centers, and . The straight segment between them is the baseline. Now take any 3D point that both cameras see. The three points , , and are not collinear (unless sits on the baseline itself), so they define a plane: the epipolar plane. That plane slices through each image, and the cut it leaves behind is the epipolar line.
The epipole is where the baseline pierces each image plane. In the left image, the epipole is literally where you would see the right camera if it were a glowing dot in your scene; in the right image, is where you would see the left camera. Every epipolar line in an image passes through that image's epipole, which is exactly the fan-out you saw in the sim. For a stereo rig with the two cameras side by side and perfectly parallel, the epipoles slide off to infinity and the epipolar lines become horizontal scanlines, which is why rectified stereo pairs can be matched row by row.
The fundamental matrix: seven numbers that hold two cameras together
The fundamental matrix is the algebraic heart of all this. It is the unique matrix such that for every pair of corresponding points. Two facts about it are worth tattooing somewhere:
- It has rank 2, meaning its determinant is zero, . This is not a numerical accident. It is what forces all the epipolar lines to meet at the epipole instead of scattering. The epipole is precisely the null vector of : the direction for which .
- It has only 7 degrees of freedom. A matrix has nine entries, but is defined only up to an overall scale (multiply it by 5 and the equation is unchanged), which removes one, and the rank-2 constraint removes another. Seven numbers. As Wikipedia puts it bluntly, those seven parameters "represent the only geometric information about cameras that can be obtained through point correspondences alone." You cannot squeeze more out of raw matches than that.
Computing F from matches: the eight-point algorithm
So how do you actually find these seven numbers from a real pair of photographs? You collect point correspondences and let the constraint do the work. Each matching pair gives you one linear equation in the entries of . Stack up enough of them and you can solve.
The classic recipe is the eight-point algorithm:
- Find eight or more corresponding point pairs across the two images.
- Turn each pair into one row of a linear system built from .
- Solve that system with the singular value decomposition (SVD) to get a least-squares estimate of .
- The raw estimate will not be exactly rank 2, so project it back onto the nearest rank-2 matrix (zero out the smallest singular value). This step is what guarantees a clean, single epipole.
In the real world, some of your "matches" are wrong, so you wrap the whole thing in RANSAC, which repeatedly fits on small random subsets and keeps the fit that the most matches agree with. The mismatches, the outliers, are points that badly violate the epipolar constraint, so epipolar geometry doubles as an outlier detector: anything far off its predicted line is a bad correspondence.
Much of the modern treatment of all this traces back to the British computer scientist Andrew Zisserman (b. 1957), at Oxford and later DeepMind. His textbook with Richard Hartley, Multiple View Geometry in Computer Vision, became the canonical reference for epipolar geometry, the fundamental matrix, and the algorithms in this chapter.
The essential matrix: F's calibrated cousin
If you happen to know the cameras' internal calibration (the focal lengths and principal points packed into the intrinsic matrices and ), you can strip the lens out of the picture and work in clean, normalized coordinates. What is left is the essential matrix :
where is the fundamental matrix you just computed and are the two intrinsic calibration matrices. The essential matrix is the purer object: it encodes only the rotation and translation between the two camera poses, with the lens distortion and pixel scaling already divided out. It factors as
Here is the rotation from one camera frame to the other, is the translation between their centers, and is the skew-symmetric matrix that turns a cross product into a matrix multiply (so that for any vector ). Because knows about and directly, you can decompose it to recover the camera's motion, which is the seed of structure from motion and visual SLAM.
The two matrices divide the labor neatly:
| | Fundamental | Essential | |---|---|---| | Calibration needed | No | Yes (, known) | | Encodes | , , combined | Just , | | Degrees of freedom | 7 | 5 | | Works in | Pixel coordinates | Normalized coordinates |
For the advanced reader → Why x'ᵀFx = 0 falls straight out of the projection equations
Start from the calibrated case. Put the first camera at the origin so its projection is , and the second at pose so . Work in normalized coordinates and , so the lens drops away and the back-projected rays are simply from the first center and from the second.
The coplanarity condition is the geometric core: the ray to the point from the first camera, the ray from the second, and the baseline all lie in one plane (the epipolar plane). Three coplanar vectors have a vanishing scalar triple product:
Rewrite the cross product as a matrix: , where
Substituting gives , and defining the essential matrix as collapses this to
Now undo the normalization with :
which rearranges to the relation . The rank-2 property is now obvious: is a skew-symmetric matrix and is therefore singular (any odd-sized skew matrix has determinant zero), so , and hence , inherits rank 2. The epipole is the null vector: because , and projects to exactly the image of the other camera center.
Key takeaways
- The epipolar constraint turns a 2D search into a 1D one. A point in one image must lie on a single line in the other, the epipolar line, and that line is read off directly from .
- The fundamental matrix packs two cameras into 7 numbers. It is , rank 2 (), and scale-free, and those seven parameters are everything point matches can ever tell you about the camera pair.
- The epipole is the pivot and the null vector. Every epipolar line passes through it, and it satisfies ; geometrically it is where the baseline pierces the image.
- The essential matrix is the calibrated, 5-DOF version that factors as , so it hands you the camera's rotation and translation directly.
- Estimate, then enforce, then robustify. The eight-point algorithm solves for with SVD; normalization (Hartley, 1997) makes it accurate; rank-2 projection makes it geometrically valid; RANSAC throws out the bad matches.
Two pictures of the same world are never strangers. The rigid geometry of the cameras ties every point in one frame to a single ruled line in the other, and that line is the quiet promise underneath stereo depth, motion estimation, and every robot that finds its way by looking.
Switch eyes one more time and watch your finger jump against the still wall. You are not seeing two images. You are seeing the line that joins them.