Algorithm Search⌘K

Problemcore

Relative pose estimation

Also called relative orientation, two-view motion estimation.

Find the rotation and the direction of translation between two calibrated cameras from matched image points.

Relative pose estimation is the problem of finding the motion between two calibrated cameras from points matched in their images. The answer is a rotation RR and a translation t\mathbf{t} with X2=RX1+t\mathbf{X}_2 = R\mathbf{X}_1 + \mathbf{t} for the coordinates of every scene point in the two camera frames. Images alone cannot give the length of t\mathbf{t}, so only its direction is found, which leaves five unknowns. The usual route goes through the essential matrix E=[t]×RE = [\mathbf{t}]_\times R: estimate EE with the five-point algorithm inside RANSAC, or with the eight-point algorithm on clean matches, then factor it by essential matrix decomposition and choose among four poses by cheirality.

In plain words

You take two photos of a scene with the same calibrated camera, from two places. You want to know how the camera turned and in which direction it moved between the two shots. You find points that appear in both photos. Each pair of points gives one condition on the motion. The turn has three unknowns and the direction of travel has two, so five pairs are enough in principle. How far the camera moved cannot be found from the photos alone: a scene twice as large, seen from twice as far, gives the same photos. The scene points must also end up in front of both cameras, which removes false answers.

Definition

Input. Matched points (x^1,i,x^2,i)(\hat{\mathbf{x}}_{1,i}, \hat{\mathbf{x}}_{2,i}), i=1,…,ni = 1, \ldots, n, in normalized image coordinates x^=K−1(u,v,1)T\hat{\mathbf{x}} = K^{-1}(u, v, 1)^{\mathsf T}, where the intrinsic matrices K1K_1 and K2K_2 are known. Some matches may be wrong.

Output. A rotation R∈SO(3)R \in SO(3) and a unit vector t\mathbf{t}, ∥t∥=1\|\mathbf{t}\| = 1, such that the cameras P1=[I∣0]P_1 = [I \mid \mathbf{0}] and P2=[R∣t]P_2 = [R \mid \mathbf{t}] explain the correct matches: for each such match there is a scene point X1\mathbf{X}_1 with x^1∼X1\hat{\mathbf{x}}_1 \sim \mathbf{X}_1 and x^2∼RX1+t\hat{\mathbf{x}}_2 \sim R\mathbf{X}_1 + \mathbf{t}, in front of both cameras. With noise, the output minimizes a chosen cost:

  • Algebraic error. ∑i(x^2,iT[t]×R x^1,i)2\sum_i (\hat{\mathbf{x}}_{2,i}^{\mathsf T}[\mathbf{t}]_\times R\,\hat{\mathbf{x}}_{1,i})^2. Cheap but without a geometric meaning.
  • Sampson error. The first-order approximation of the distance of a match to the epipolar constraint; see Sampson distance.
  • Reprojection error. Minimize over RR, t\mathbf{t} and the scene points the sum of squared image distances; under independent Gaussian image noise this is the maximum likelihood estimate. It is two-view bundle adjustment.

Ambiguities. The scale of t\mathbf{t} and of the scene is a gauge freedom and is fixed by ∥t∥=1\|\mathbf{t}\| = 1. The constraint x^2TEx^1=0\hat{\mathbf{x}}_2^{\mathsf T}E\hat{\mathbf{x}}_1 = 0 is the same for (R,t)(R, \mathbf{t}), (R,−t)(R, -\mathbf{t}) and the twisted pair of each, so cheirality is part of the problem, not an extra.

Variants

  • Uncalibrated cameras. Without KK only the fundamental matrix can be found, and the cameras only up to a projective transformation, by the projective reconstruction theorem.
  • Known rotation. If RR is known, for example from a gyroscope, each match gives the linear equation (x^2×Rx^1)⋅t=0(\hat{\mathbf{x}}_2 \times R\hat{\mathbf{x}}_1) \cdot \mathbf{t} = 0, and two matches give t\mathbf{t} as the cross product of two such normal vectors.
  • Pure rotation. If t=0\mathbf{t} = \mathbf{0}, the images are related by the homography K2RK1−1K_2RK_1^{-1}, and E=0E = 0. The rotation is found from the homography, and no depth can be found.
  • Planar scene. If all points lie on one plane, the images are related by a homography, and the pose can be found by homography decomposition, up to a two-fold ambiguity.
  • Partly known calibration. An unknown focal length, shared or separate, adds unknowns and needs more matches.
  • Many views. With more than two views, the relative poses of pairs are the input of rotation averaging and translation averaging on the view graph.

Examples

The running example. For 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} and t=(1,0,0)\mathbf{t} = (1, 0, 0), the essential matrix is E=(0000.60−0.8010)E = \begin{pmatrix} 0 & 0 & 0 \\ 0.6 & 0 & -0.8 \\ 0 & 1 & 0 \end{pmatrix}. The point X1=(0,0,5)\mathbf{X}_1 = (0, 0, 5) maps to X2=(4,0,4)\mathbf{X}_2 = (4, 0, 4), so the match is (0,0)↔(1,0)(0, 0) \leftrightarrow (1, 0), with depths 5 and 4.

Four poses from one matrix. The decomposition of this EE gives four poses. Only (R,t)(R, \mathbf{t}) puts the point in front of both cameras, with depths (5,4)(5, 4). The pose (R,−t)(R, -\mathbf{t}) gives depths (−5,−4)(-5, -4), and the twisted pair gives (−57,47)(-\frac57, \frac47) and (57,−47)(\frac57, -\frac47); see essential matrix decomposition.

Scale. The cameras (R,2t)(R, 2\mathbf{t}) with the point (0,0,10)(0, 0, 10) give the same images. The output has ∥t∥=1\|\mathbf{t}\| = 1.

Non-example. If all matches satisfy x^2∼Rx^1\hat{\mathbf{x}}_2 \sim R\hat{\mathbf{x}}_1 for one rotation, the camera did not move, and t\mathbf{t} is not defined: every direction fits.

Known algorithms

algorithm matches output notes
five-point algorithm 5 up to 10 essential matrices minimal; used inside RANSAC
eight-point algorithm, essential variant 8 or more one essential matrix linear; on inliers only
normalized eight-point or seven-point, then E=K2TFK1E = K_2^{\mathsf T}FK_1 8 or 7 FF, then EE ignores the calibration during the fit
essential matrix decomposition 1 or more for the test (R,t)(R, \mathbf{t}) four candidates, chosen by cheirality
nonlinear refinement all inliers (R,t)(R, \mathbf{t}) Levenberg-Marquardt on the Sampson or reprojection error

The usual pipeline is: feature matching, the five-point algorithm in RANSAC with the Sampson distance to count inliers, decomposition with cheirality, triangulation of the inliers, and a nonlinear refinement.

AlgorithmTimeSpacePropertiesCode
Eight-point algorithmΘ(n) worst · average · bestΘ(n) extradeterministicexactofflineiterative1 language
Pose recovery from the essential matrixΘ(n) worst · average · bestΘ(1) extradeterministicexactofflineiterative1 language
Five-point algorithmΘ(n) worst · average · bestΘ(n) extradeterministicexactofflineiterative1 language
Normalized eight-point algorithmΘ(n) worst · average · bestΘ(n) extradeterministicexactofflineiterative1 language
Seven-point algorithmΘ(1) worst · average · bestΘ(1) extradeterministicexactofflineiterative1 language

Bounds

  • Degrees of freedom. 3 for RR and 2 for the direction of t\mathbf{t}, so 5. Each match gives one equation, so 5 matches are the minimum.
  • Number of solutions. Five matches in general position give at most 10 complex essential matrices, by the result of Demazure (1988). Each essential matrix gives four poses, and cheirality keeps at most one of them for each point seen in front of the cameras.
  • Exact recovery. With exact matches of points in general position and t≠0\mathbf{t} \ne \mathbf{0}, eight matches fix EE linearly, and EE fixes (R,t)(R, \mathbf{t}) up to the four choices.
  • Degenerate scenes. If the points and both camera centers lie on certain quadric surfaces, two different poses explain the same images; these are the critical surfaces of Hartley and Zisserman (Section 22.2). Planar scenes are a special case for the eight-point algorithm but not for the five-point algorithm.
  • Conditioning. A short baseline makes the direction of t\mathbf{t} uncertain. With a narrow field of view, a small rotation and a small sideways translation have similar effects on the images.

Reductions

  • To essential matrix estimation. Relative pose reduces to finding EE and then decomposing it, since EE and the pose determine each other up to the four choices and the scale.
  • From the fundamental matrix. With known K1K_1 and K2K_2, any estimate of FF gives E=K2TFK1E = K_2^{\mathsf T}FK_1, which must then be projected onto the essential matrices by the characterization.
  • To triangulation. Once (R,t)(R, \mathbf{t}) is known, the scene points follow by point triangulation, up to the global scale.
  • Relation to absolute pose. If the scene points are known in one frame, the pose of the second camera is a perspective-n-point problem, which also fixes the scale.

Applications

References

  1. Richard Hartley and Andrew Zisserman, Multiple View Geometry in Computer Vision, second edition, Cambridge University Press, 2004, Section 9.6, The essential matrix (the four solutions for the pose), Chapter 11 (computation of the fundamental matrix) and Section 22.2 (degenerate configurations of two views)
  2. Yi Ma, Stefano Soatto, Jana Kosecka and S. Shankar Sastry, An Invitation to 3-D Vision, Springer, 2004, Chapter 5, Section 5.2.1 (pose recovery from the essential matrix) and Section 5.3 (planar scenes and the homography)
  3. David Nister, An efficient solution to the five-point relative pose problem, IEEE Transactions on Pattern Analysis and Machine Intelligence 26(6), 2004, the five-point relative pose problem and its solution inside a robust estimator
  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)
WritingW2 basic
  • a contract.yaml