Algorithm Search⌘K

Problemcore

Bundle adjustment

Also called photogrammetric bundle adjustment.

Refine all camera parameters and 3D points together to minimize the total reprojection error, a large sparse nonlinear least squares problem.

Bundle adjustment is the problem of refining a 3D reconstruction, all camera parameters and all 3D points together, so that the predicted image positions of the points agree as well as possible with the measured ones. The cost is the sum of the squared reprojection errors, possibly weighted or made robust, over all observations. The name comes from photogrammetry: each camera has a bundle of light rays through its center, and the problem adjusts the bundles until the rays meet the points. It is a nonlinear least squares problem with a special structure: each residual depends on one camera and one point only, so the Jacobian is very sparse and the normal equations have an arrow shape. Under Gaussian pixel noise its solution is the maximum likelihood reconstruction. It is the final, and usually the most accurate, step of structure from motion, and it runs repeatedly inside incremental structure from motion and visual SLAM. The cost is unchanged by a global similarity transformation (or a projective one, for uncalibrated cameras), which is the subject of gauge freedom. The algorithms are pages of their own: sparse bundle adjustment and inexact Newton bundle adjustment, both built on the reduced camera system.

In plain words

You have many photos of a scene, and in each photo you have marked where some scene points appear. You also have a rough guess of where each camera stood, where it looked, and where each point is in 3D. Bundle adjustment improves all these guesses at once. For every mark, it computes where the guessed point would appear in the guessed camera, and it measures the distance to the real mark. It then moves the cameras and the points together until the total of these squared distances is as small as possible. The result is the reconstruction that best explains the photos. Moving or turning the whole scene, or making it bigger, does not change any distance, so one camera and the scale must be fixed to get a single answer.

Definition

Input.

  • NN cameras with start values. In the calibrated case, camera ii has a rotation Ri∈SO(3)R_i \in SO(3) and a translation tit_i, and a known intrinsic matrix Ki=(fxscx0fycy001)K_i = \begin{pmatrix} f_x & s & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{pmatrix}. In the self-calibrating case, KiK_i and lens distortion terms are unknowns too.
  • nn points Xj∈R3X_j \in \mathbb{R}^3 with start values.
  • mm observations (i,j,xij)(i, j, x_{ij}): point jj is measured at pixel xijx_{ij} in camera ii, optionally with a 2×22 \times 2 covariance Σij\Sigma_{ij}.

The camera frame has XX right, YY down and ZZ forward, a world point maps to Xc=RiXj+tiX_c = R_i X_j + t_i, it is in front of the camera if Z>0Z > 0, and its pixel is π(KiXc)\pi(K_i X_c) with π(u,v,w)=(u/w,v/w)\pi(u, v, w) = (u / w, v / w) and pixel centers at integer coordinates.

Output. Parameters that minimize

F=12∑(i,j)ρ(∥π(Ki(RiXj+ti))−xij∥Σij2),F = \frac12 \sum_{(i, j)} \rho\left( \| \pi(K_i (R_i X_j + t_i)) - x_{ij} \|^2_{\Sigma_{ij}} \right),

where ∥e∥Σ2=eTΣ−1e\|e\|^2_\Sigma = e^{\mathsf T} \Sigma^{-1} e and ρ\rho is the identity for the plain least squares cost or a robust function such as the Huber cost. In practice a local minimizer near the start is found.

Structure. With 6 parameters per camera and 3 per point, there are 2m2m residuals and 6N+3n6N + 3n unknowns. The residual rijr_{ij} depends only on camera ii and point jj, so each row pair of the Jacobian has one 2×62 \times 6 block and one 2×32 \times 3 block. The normal matrix JTJ=(UWWTV)J^{\mathsf T} J = \begin{pmatrix} U & W \\ W^{\mathsf T} & V \end{pmatrix} has block diagonal UU and VV; the block WijW_{ij} is nonzero only where camera ii sees point jj.

Gauge. For calibrated cameras, FF does not change under a similarity transformation of the world: Xj→sQXj+cX_j \to s Q X_j + c, Ri→RiQTR_i \to R_i Q^{\mathsf T}, ti→sti−RiQTct_i \to s t_i - R_i Q^{\mathsf T} c, with 7 degrees of freedom. For uncalibrated projective cameras the invariance group is the projective group, with 15 degrees of freedom. So the minimizer is never unique, and JTJJ^{\mathsf T} J is singular; see gauge freedom.

Variants

  • Calibrated or self-calibrating. Intrinsics fixed, shared by all cameras, or one set per camera; often with radial and tangential distortion.
  • Projective bundle adjustment. Unknown 3×43 \times 4 camera matrices PiP_i and homogeneous points; the gauge has 15 degrees of freedom.
  • Robust bundle adjustment. A robust ρ\rho, such as Huber or Cauchy, limits the effect of wrong matches; it is solved by reweighting, see M-estimators.
  • Motion only and structure only. Fix the points and refine the cameras (perspective-n-point refinement), or fix the cameras and refine the points (optimal triangulation for two views). Each splits into independent small problems.
  • Local and windowed. Refine only recent cameras and the points they see, as in sliding window bundle adjustment and the local bundle adjustment of ORB-SLAM.
  • With other measurements. Add residuals for GPS positions, inertial measurements, known distances or control points.
  • Other features and camera models. Lines, points at infinity in homogeneous form, inverse depth points, rolling shutter cameras, and fisheye or spherical cameras.
  • Photometric bundle adjustment. Minimize differences of pixel intensities instead of feature positions, as in direct visual odometry.

Examples

A small synthetic scene. Four cameras with fx=fy=800f_x = f_y = 800 and (cx,cy)=(320,240)(c_x, c_y) = (320, 240) look from a distance of about 5 at 20 points in a cube of side 2. Every camera sees every point: m=80m = 80 observations, 160 residuals. With camera 0 fixed, there are 18+60=7818 + 60 = 78 unknowns, of which one direction (the scale) is still a gauge freedom. Starting from cameras and points perturbed to an RMS reprojection error of 34.1 pixels, sparse Levenberg-Marquardt reaches 4.6⋅10−134.6 \cdot 10^{-13} pixels in 12 accepted steps on exact data, and the result equals the truth up to a scale of 0.996950.99695. With 1 pixel of Gaussian noise, the minimum cost is 52.952.9, lower than the cost 95.495.4 of the true scene. The minimizer fits the noise better than the truth, as any maximum likelihood estimate does. These are measurements from the test of sparse bundle adjustment.

Counting. For calibrated cameras, the reconstruction is locally determined, up to the gauge, only if the number of residuals is at least the number of unknowns minus the gauge: 2m≥6N+3n−72m \ge 6N + 3n - 7. The example has 160≥77160 \ge 77. Two calibrated views of five points give 20=12+15−720 = 12 + 15 - 7: the count of the minimal five-point problem.

Large photo collections. Reconstructions from internet photos have thousands of cameras and millions of points, with each point seen by only a few cameras. Agarwal, Snavely, Seitz and Szeliski (2010) studied problems of this size.

Known algorithms

algorithm cost per iteration note
Gauss-Newton or Levenberg-Marquardt, dense O((6N+3n)3)O((6N + 3n)^3) only for tiny problems
Sparse bundle adjustment O(m+∑jcj2+N3)O(m + \sum_j c_j^2 + N^3) exact damped step via the reduced camera system
Sparse bundle adjustment with sparse Cholesky of SS depends on the fill of SS for sparse camera graphs
Powell's dog leg, sparse as sparse bundle adjustment fewer factorizations after rejected steps
Inexact Newton bundle adjustment O(k(m+N))O(k (m + N)) for kk CG iterations very large problems
Iteratively reweighted least squares around any of these as the inner method robust costs

Here cjc_j is the number of cameras that see point jj. All of these find a local minimizer from a good start. The start comes from incremental or global structure from motion, or from a factorization method.

AlgorithmTimeSpacePropertiesCode
Bundle adjustment in the largeO(k (m + N)) per_iterationO(m + n + N) extradeterministiciterativelocalmonotoneiterative1 language
Sparse bundle adjustmentO(m + n N^2 + N^3) per_iterationO(m + N^2) extradeterministiciterativelocalmonotoneiterative1 language

Bounds

  • No global guarantee. The cost is nonconvex, and the standard methods find a local minimizer only. No polynomial time algorithm for the global minimum of general bundle adjustment is known. The nonlinear least squares page shows that the general problem is NP-hard, but that proof uses residuals of another form and does not carry over to bundle adjustment.
  • Accuracy bound (theorem). With independent Gaussian pixel noise of standard deviation σ\sigma, the covariance of any unbiased estimate of the gauge-fixed parameters is at least σ2(JTJ)−1\sigma^2 (J^{\mathsf T} J)^{-1} restricted to those parameters, the Cramér-Rao bound, and the maximum likelihood estimate reaches it to first order for small noise. Because of the gauge, the bound is stated for gauge-invariant quantities or for a fixed gauge; Kanatani and Morris (2001) treat this in detail.
  • Expected residual. At the minimizer, 2F/σ22F / \sigma^2 is approximately chi-squared with 2m−(6N+3n−7)2m - (6N + 3n - 7) degrees of freedom, so the RMS residual per coordinate is a little below σ\sigma. This is used to check the noise model.
  • Cost of a step. Any exact method must at least read the mm observations, so a step costs Ω(m)\Omega(m). With the reduced camera system, the extra cost is that of solving a 6N×6N6N \times 6N system.

Reductions

  • To nonlinear least squares. Bundle adjustment is an instance of nonlinear least squares, with the rotation updated on SO(3)SO(3) by a local parametrization, for example R←exp⁡([ω]×)RR \leftarrow \exp([\omega]_\times) R.
  • To the reduced camera system. Each Gauss-Newton or Levenberg-Marquardt step reduces exactly to a linear system in the camera parameters, followed by independent 3×33 \times 3 solves for the points.
  • Affine cameras. For affine cameras with every point seen in every view, the maximum likelihood solution under isotropic Gaussian noise is given in closed form by the factorization method of Tomasi and Kanade, a truncated SVD (theorem; Hartley and Zisserman, Chapter 18).
  • To pose graph optimization. Eliminating the points, or approximating their effect by relative pose constraints, gives a pose graph optimization problem, which is smaller and often used to start or to replace bundle adjustment in SLAM.

Applications

  • Structure from motion: the final refinement, and repeated refinements during incremental reconstruction.
  • Visual SLAM and visual odometry: local bundle adjustment over a window of key frames, as in ORB-SLAM and visual odometry systems.
  • Aerial and close range photogrammetry, mapping and surveying, where the method comes from.
  • Camera calibration: the final refinement of Zhang's method is a bundle adjustment with a known planar target.
  • Multi-camera rigs and augmented reality, where the camera poses must be accurate to a fraction of a pixel.

References

  1. Bill Triggs, Philip F. McLauchlan, Richard I. Hartley and Andrew W. Fitzgibbon, Bundle adjustment, a modern synthesis, in Vision Algorithms, Theory and Practice, Lecture Notes in Computer Science 1883, Springer, 2000, 298-372, the whole survey: the problem and its cost functions (Sections 2 to 4), the network structure (Section 6), gauge freedom (Section 9) and the historical appendix
  2. Richard Hartley and Andrew Zisserman, Multiple View Geometry in Computer Vision, second edition, Cambridge University Press, 2004, Chapter 18, N-view computational methods (bundle adjustment and the affine factorization algorithm) and Appendix 6, Iterative estimation methods (sparse Levenberg-Marquardt)
  3. Richard Szeliski, Computer Vision, Algorithms and Applications, second edition, Springer, 2022, Chapter 11, Structure from motion and SLAM (bundle adjustment, exploiting sparsity, uncertainty and ambiguities)
  4. Manolis I. A. Lourakis and Antonis A. Argyros, SBA: A software package for generic sparse bundle adjustment, ACM Transactions on Mathematical Software 36(1), 2009, the problem statement and the sparse structure of the Jacobian
  5. Sameer Agarwal, Noah Snavely, Steven M. Seitz and Richard Szeliski, Bundle adjustment in the large, Computer Vision ECCV 2010, Lecture Notes in Computer Science 6312, Springer, 2010, 29-42, the problem statement for large photo collections and the experiments

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