Algorithm Search⌘K

Conceptcore

Epipolar geometry

Also called epipolar constraint, two-view geometry.

The geometry of two views of one scene. A point in one image must have its match on a line in the other image, and all these lines pass through the image of the other camera center.

Epipolar geometry is the geometry of two images of one scene taken by two pinhole cameras at different places. It depends only on the two cameras, their internal parameters and their relative pose, and not on the scene. Its main result is the epipolar constraint: if x1\mathbf{x}_1 and x2\mathbf{x}_2 are images of the same 3D point, then x2\mathbf{x}_2 lies on a line in image 2 that x1\mathbf{x}_1 fixes, and the other way round. In matrices the constraint is x2TFx1=0\mathbf{x}_2^{\mathsf T}F\mathbf{x}_1 = 0 for the fundamental matrix FF in pixel coordinates, and x2TEx1=0\mathbf{x}_2^{\mathsf T}E\mathbf{x}_1 = 0 for the essential matrix EE in normalized coordinates. This page is about the geometry; the two matrices have their own pages, and the methods that find them from matches are the eight-point, seven-point and five-point algorithms.

In plain words

Two cameras look at the same scene from two places. Pick a point in the first image. The point in space that made it lies somewhere on the ray from the first camera through that image point, but the image alone does not say how far along the ray. Seen from the second camera, that ray is a line. So the matching point in the second image must be on that line, and a search for the match can look along one line instead of over the whole image. Every such line in the second image passes through one special point: the place where the second camera sees the first camera. The same holds the other way round. The positions of these lines depend only on how the two cameras are placed, not on what they look at.

The idea

Setup. We use the conventions of this area. Camera 1 has the frame X1\mathbf{X}_1, camera 2 has the frame X2\mathbf{X}_2, and the relative pose (R,t)(R, \mathbf{t}) maps one to the other: X2=RX1+t\mathbf{X}_2 = R\mathbf{X}_1 + \mathbf{t}. Both frames have ZZ forward. The camera matrices are P1=K1[I∣0]P_1 = K_1[I \mid \mathbf{0}] and P2=K2[R∣t]P_2 = K_2[R \mid \mathbf{t}], with the intrinsic matrices K1K_1 and K2K_2. Image points are homogeneous 3-vectors, and the normalized image point of a pixel x\mathbf{x} is x^=K−1x\hat{\mathbf{x}} = K^{-1}\mathbf{x}. The center of camera 1 is C1=0\mathbf{C}_1 = \mathbf{0} in frame 1, and the center of camera 2 is C2=−RTt\mathbf{C}_2 = -R^{\mathsf T}\mathbf{t} in frame 1.

The named objects.

  • The baseline is the line through the two centers C1\mathbf{C}_1 and C2\mathbf{C}_2.
  • An epipolar plane is a plane that contains the baseline. Each 3D point off the baseline lies on exactly one epipolar plane, together with the two centers.
  • The epipole e1\mathbf{e}_1 is the image of C2\mathbf{C}_2 in camera 1, and e2\mathbf{e}_2 is the image of C1\mathbf{C}_1 in camera 2. Both are the points where the baseline meets the image planes. An epipole can be at infinity (when the baseline is parallel to the image plane) and can be the image of a center behind the camera.
  • An epipolar line is the intersection of an epipolar plane with an image plane. In image 2, the epipolar line of x1\mathbf{x}_1 is the image of the ray of x1\mathbf{x}_1. All epipolar lines of one image pass through its epipole.

The constraint. Let X\mathbf{X} be a point with X1=λ1x^1\mathbf{X}_1 = \lambda_1\hat{\mathbf{x}}_1 and X2=λ2x^2\mathbf{X}_2 = \lambda_2\hat{\mathbf{x}}_2. The three vectors X2\mathbf{X}_2, t\mathbf{t} and RX1=X2−tR\mathbf{X}_1 = \mathbf{X}_2 - \mathbf{t}, all written in frame 2, lie in one plane (the epipolar plane), so

X2T(t×RX1)=0⟹x^2T[t]×R x^1=0,\mathbf{X}_2^{\mathsf T}(\mathbf{t} \times R\mathbf{X}_1) = 0 \quad\Longrightarrow\quad \hat{\mathbf{x}}_2^{\mathsf T}[\mathbf{t}]_\times R\,\hat{\mathbf{x}}_1 = 0 ,

where [t]×[\mathbf{t}]_\times is the skew matrix of t\mathbf{t}. The matrix E=[t]×RE = [\mathbf{t}]_\times R is the essential matrix. With x^=K−1x\hat{\mathbf{x}} = K^{-1}\mathbf{x} the same equation in pixels is x2TFx1=0\mathbf{x}_2^{\mathsf T}F\mathbf{x}_1 = 0 with F=K2−TEK1−1F = K_2^{-\mathsf T}EK_1^{-1}. This is the form of Longuet-Higgins (1981) for EE, and of Hartley and Zisserman (Section 9.2) for FF.

Lines and epipoles in matrix form. For a fixed x1\mathbf{x}_1, the equation x2T(Fx1)=0\mathbf{x}_2^{\mathsf T}(F\mathbf{x}_1) = 0 says that x2\mathbf{x}_2 lies on the line l2=Fx1\mathbf{l}_2 = F\mathbf{x}_1. In the same way the epipolar line of x2\mathbf{x}_2 in image 1 is l1=FTx2\mathbf{l}_1 = F^{\mathsf T}\mathbf{x}_2. The epipoles are the null vectors: Fe1=0F\mathbf{e}_1 = \mathbf{0} and FTe2=0F^{\mathsf T}\mathbf{e}_2 = \mathbf{0}. Since e2T(Fx1)=(FTe2)Tx1=0\mathbf{e}_2^{\mathsf T}(F\mathbf{x}_1) = (F^{\mathsf T}\mathbf{e}_2)^{\mathsf T}\mathbf{x}_1 = 0 for all x1\mathbf{x}_1, every line l2\mathbf{l}_2 passes through e2\mathbf{e}_2. FF is singular because it has a null vector; it has rank 2 whenever the centers differ.

The two pencils. The epipolar lines of an image form a pencil, the set of lines through the epipole, which is a projective line. The epipolar planes give a one-to-one map between the pencil of image 1 and the pencil of image 2: an epipolar line in one image matches exactly one in the other. This map is a 1D homography with 3 degrees of freedom, and with the 2 + 2 coordinates of the two epipoles it gives the 7 degrees of freedom of FF (Hartley and Zisserman, Section 9.2).

What it does not fix. The constraint is one equation per match. It says that a match is possible, not that it is right: a wrong match that falls on the epipolar line passes. It also does not see the scale of t\mathbf{t}: EE and λE\lambda E give the same constraint, so from two images alone the baseline is known only in direction. Points on the baseline have no epipolar plane, and their images are the epipoles.

Special motions.

  • Pure rotation, t=0\mathbf{t} = \mathbf{0}: the centers coincide, E=0E = 0, and there is no epipolar geometry. The two images are related by the homography K2RK1−1K_2RK_1^{-1}.
  • Translation along the optical axis, R=IR = I and t=(0,0,tz)\mathbf{t} = (0, 0, t_z): the epipole is the principal point, and the epipolar lines are the lines through it. The image points move along these lines, away from or toward the epipole.
  • Sideways translation, R=IR = I, K1=K2K_1 = K_2 and t=(−b,0,0)\mathbf{t} = (-b, 0, 0): the epipoles are the point at infinity (1,0,0)(1, 0, 0), and the epipolar lines are the image rows. This is the rectified case.
  • A planar scene: the matches also satisfy a homography. The epipolar geometry is still defined by the cameras, but the matches cannot fix it, because many matrices FF fit them. See the degenerate cases on the eight-point page.

Examples

A rotation about the Y axis and a sideways step. Let K1=K2=IK_1 = K_2 = I (normalized coordinates), R=(0.800.6010−0.600.8)R = \begin{pmatrix} 0.8 & 0 & 0.6 \\ 0 & 1 & 0 \\ -0.6 & 0 & 0.8 \end{pmatrix}, a rotation by about 36.8736.87 degrees about YY, and t=(1,0,0)\mathbf{t} = (1, 0, 0). Then

E=[t]×R=(00000−1010)R=(0000.60−0.8010).E = [\mathbf{t}]_\times R = \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0 \end{pmatrix} R = \begin{pmatrix} 0 & 0 & 0 \\ 0.6 & 0 & -0.8 \\ 0 & 1 & 0 \end{pmatrix} .
  • Epipoles. E(0.8,0,0.6)T=0E(0.8, 0, 0.6)^{\mathsf T} = \mathbf{0}, so e1=(0.8,0,0.6)∼(4/3,0,1)\mathbf{e}_1 = (0.8, 0, 0.6) \sim (4/3, 0, 1). This is the image of C2=−RTt=(−0.8,0,−0.6)\mathbf{C}_2 = -R^{\mathsf T}\mathbf{t} = (-0.8, 0, -0.6), which has Z<0Z < 0: camera 2 is behind camera 1, and the epipole is the image of a point behind the camera. ET(1,0,0)T=0E^{\mathsf T}(1, 0, 0)^{\mathsf T} = \mathbf{0}, so e2=(1,0,0)\mathbf{e}_2 = (1, 0, 0), a point at infinity: C1\mathbf{C}_1 is at X2=t=(1,0,0)\mathbf{X}_2 = \mathbf{t} = (1, 0, 0), with Z=0Z = 0. So the epipolar lines in image 2 are parallel, and all are horizontal.
  • A match. The point X1=(0,0,5)\mathbf{X}_1 = (0, 0, 5) gives X2=RX1+t=(3,0,4)+(1,0,0)=(4,0,4)\mathbf{X}_2 = R\mathbf{X}_1 + \mathbf{t} = (3, 0, 4) + (1, 0, 0) = (4, 0, 4), so x1=(0,0)\mathbf{x}_1 = (0, 0) and x2=(1,0)\mathbf{x}_2 = (1, 0). The line l2=E(0,0,1)T=(0,−0.8,0)\mathbf{l}_2 = E(0, 0, 1)^{\mathsf T} = (0, -0.8, 0) is v=0v = 0, and x2\mathbf{x}_2 lies on it. The depths are 5 in camera 1 and 4 in camera 2.
  • A second match. X1=(0,2.5,5)\mathbf{X}_1 = (0, 2.5, 5) gives X2=(4,2.5,4)\mathbf{X}_2 = (4, 2.5, 4), x1=(0,0.5)\mathbf{x}_1 = (0, 0.5) and x2=(1,0.625)\mathbf{x}_2 = (1, 0.625). The line l2=E(0,0.5,1)T=(0,−0.8,0.5)\mathbf{l}_2 = E(0, 0.5, 1)^{\mathsf T} = (0, -0.8, 0.5) is v=0.625v = 0.625; it contains x2\mathbf{x}_2. The other way, l1=ET(1,0.625,1)T=(0.375,1,−0.5)\mathbf{l}_1 = E^{\mathsf T}(1, 0.625, 1)^{\mathsf T} = (0.375, 1, -0.5). It passes through x1\mathbf{x}_1, since 0+0.5−0.5=00 + 0.5 - 0.5 = 0, and through e1=(4/3,0)\mathbf{e}_1 = (4/3, 0), since 0.375⋅4/3−0.5=00.375 \cdot 4/3 - 0.5 = 0.

The same cameras in pixels. With K1=K2=(50003200500240001)K_1 = K_2 = \begin{pmatrix} 500 & 0 & 320 \\ 0 & 500 & 240 \\ 0 & 0 & 1 \end{pmatrix}, the first match becomes (320,240)↔(820,240)(320, 240) \leftrightarrow (820, 240) and the second (320,490)↔(820,552.5)(320, 490) \leftrightarrow (820, 552.5). The fundamental matrix page computes FF for this case.

The rectified pair. With R=IR = I, K1=K2=KK_1 = K_2 = K with focal length ff and zero skew, and camera 2 at C2=(b,0,0)\mathbf{C}_2 = (b, 0, 0), we get t=−RC2=(−b,0,0)\mathbf{t} = -R\mathbf{C}_2 = (-b, 0, 0), and

F=K−T[t]×K−1=bf(0000010−10)∼(00000−1010).F = K^{-\mathsf T}[\mathbf{t}]_\times K^{-1} = \frac{b}{f}\begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & 1 \\ 0 & -1 & 0 \end{pmatrix} \sim \begin{pmatrix} 0 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0 \end{pmatrix} .

The constraint is x2TFx1=v1−v2=0\mathbf{x}_2^{\mathsf T}F\mathbf{x}_1 = v_1 - v_2 = 0 for the second form: a match is on the same row. This is why stereo rectification maps both images so that FF takes this form, and the search for a match becomes a search for the disparity along a row.

Where it is used

References

  1. Richard Hartley and Andrew Zisserman, Multiple View Geometry in Computer Vision, second edition, Cambridge University Press, 2004, Chapter 9, Epipolar Geometry and the Fundamental Matrix: Section 9.1 (epipolar geometry) and Section 9.2 (the fundamental matrix, its derivation and properties)
  2. Yi Ma, Stefano Soatto, Jana Kosecka and S. Shankar Sastry, An Invitation to 3-D Vision, Springer, 2004, Chapter 5, Section 5.1.1 (the epipolar constraint and the essential matrix)
  3. H. C. Longuet-Higgins, A computer algorithm for reconstructing a scene from two projections, Nature 293, 1981, 133-135, the coplanarity constraint between the two rays and the baseline, written as a bilinear form in the image coordinates
  4. Richard Szeliski, Computer Vision, Algorithms and Applications, second edition, Springer, 2022, Section 11.3, Two-frame structure from motion

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/2AW6EF/text.yaml