Two-view geometry & epipolar lines

A point in one image fixes only a ray in space, not a 3D point. Seen from a second camera, that ray is a line, and the matching point has to lie on it. Click a point in image 0, slide the 3D point along its ray, and move the second camera to see how the epipolar lines, the epipoles and the fundamental matrix FF change.

Image 0 click to select x0x_0; near a corner it snaps to it
Image 1 epipolar line l1=Fx0l_1 = F x_0 epipole
Scene and cameras baseline C0C1C_0 C_1 rays through XX epipolar plane and lines drag to orbit, scroll to zoom

Two cameras, one point

Two cameras with centers C0C_0 and C1C_1 look at the same scene. A 3D point XX appears in image 0 at x0x_0 and in image 1 at x1x_1. The construction is symmetric, and all its parts lie in one plane, the epipolar plane through C0C_0, C1C_1 and XX:

Every point XX has its own epipolar plane, but they all contain the baseline: they rotate about it like the pages of a book. So all epipolar lines of an image pass through its epipole, and together they form a pencil of lines.

Why the match has to lie on a line

The camera center is the right null space of the projection matrix, PC=0P C = 0. If XX is on the ray through CC, so is every point X+λCX + \lambda C, and they all project to the same pixel:

x≅P(X+λC)=PX+λPC=PXx \cong P (X + \lambda C) = P X + \lambda P C = P X

A pixel x0x_0 therefore only tells us the ray from C0C_0 through x0x_0, not where XX is on it. Camera 1 sees this ray from the side, as a line: the epipolar line l1l_1. Whatever depth XX has, x1x_1 lies on l1l_1, so the search for the corresponding point shrinks from the whole image to a line. Once it is found, the two rays can be intersected, which gives the depth of XX.

Backprojection with the pseudo-inverse

P0P_0 is a 3 × 4 matrix and has no inverse, but its pseudo-inverse P0+=P0⊤(P0P0⊤)−1P_0^+ = P_0^\top (P_0 P_0^\top)^{-1} gives a point with the same projection:

X+=P0+x0,P0X+=P0P0+x0=x0X^+ = P_0^+ x_0, \qquad P_0 X^+ = P_0 P_0^+ x_0 = x_0

X+X^+ lies on the ray, and together with the camera center it defines it: the ray is join⁡(X+,C0)\operatorname{join}(X^+, C_0).

The fundamental matrix

Project both points of the ray into camera 1. C0C_0 goes to the epipole e1=P1C0e_1 = P_1 C_0, and X+X^+ goes to P1P0+x0P_1 P_0^+ x_0. In homogeneous coordinates the line through two points is their cross product, and the cross product with e1e_1 is a matrix product with the anti-symmetric matrix [e1]×[e_1]_\times:

l1=e1×P1P0+x0=[e1]×P1P0+⏟F x0,[e]×=[0−e2e1e20−e0−e1e00]l_1 = e_1 \times P_1 P_0^+ x_0 = \underbrace{[e_1]_\times P_1 P_0^+}_{F}\, x_0, \qquad [e]_\times = \begin{bmatrix} 0 & -e_2 & e_1 \\ e_2 & 0 & -e_0 \\ -e_1 & e_0 & 0 \end{bmatrix}

(here e=(e0,e1,e2)⊤e = (e_0, e_1, e_2)^\top are the three components of one epipole). The fundamental matrix FF is a linear map from points in image 0 to lines in image 1, and it contains the intrinsic and extrinsic parameters of both cameras. Since x1x_1 lies on l1l_1:

l1=Fx0,x1⊤Fx0=0,l0=F⊤x1l_1 = F x_0, \qquad x_1^\top F x_0 = 0, \qquad l_0 = F^\top x_1

This is the epipolar constraint. It holds for every pair of corresponding points, and it involves only pixels and FF, not the 3D point. That is what makes it possible to estimate FF from correspondences alone, with the 8-point algorithm.

FF is singular

[e1]×[e_1]_\times has rank 2, because [e1]×e1=e1×e1=0[e_1]_\times e_1 = e_1 \times e_1 = 0. So FF has rank 2 too, and det⁡F=0\det F = 0. Geometrically, FF maps a 2D family of points to a 1D family of lines, the pencil through e1e_1: every line Fx0F x_0 contains e1e_1, i.e. e1⊤F=0e_1^\top F = 0. The epipole e0e_0 itself has no epipolar line, Fe0=0F e_0 = 0: the ray through e0e_0 is the baseline, which camera 1 sees as the single point e1e_1. Like every homogeneous matrix, FF is only defined up to scale; the panel scales it to ∥F∥=1\|F\| = 1.

Special camera arrangements

If the cameras have the same orientation and are only shifted sideways, the baseline is parallel to both image planes. The epipoles move to infinity, and the epipolar lines become parallel and horizontal: a match is on the same image row. Stereo systems aim for exactly this, and rectification warps the images of any two cameras so that the epipolar lines become parallel to the image rows. If camera 1 moves straight forward, the epipole lies in the image, at the point that all epipolar lines radiate from: the focus of expansion of the motion.

Try this