Problemcore
Structure from motion
Also called structure and motion recovery.
Recover the 3D points of a scene and the poses of the cameras that saw them from feature matches across a set of images.
Structure from motion (SfM) is the problem of recovering the 3D positions of scene points (the structure) and the poses, and sometimes the calibrations, of the cameras that took a set of images (the motion), from the image positions of the points alone. The data are feature tracks: for each scene point, the pixels where it appears in the images that see it. The cameras follow the pinhole model with the camera projection matrix , so the problem is to invert the projection equations for many cameras and points at once. A solution is fixed only up to a change of the world frame: a similarity for calibrated cameras and a projective map for uncalibrated ones. The usual final answer is the one that minimizes the total reprojection error, which is the bundle adjustment problem, but that cost is not convex, so practical methods first build a good start. Incremental structure from motion adds one camera at a time, global structure from motion solves for all rotations and then all positions, and the factorization methods of Tomasi and Kanade and Sturm and Triggs solve the case where every point is seen in every image by one singular value decomposition.
In plain words
You walk around a building and take many photos. In each photo, a program finds small distinctive spots and works out which spots in different photos show the same piece of the building. Structure from motion takes only these spot positions and answers two questions together: where was the camera, and which way did it point, for each photo, and where is each piece of the building in 3D? The answers depend on each other. If you knew the cameras, you could find each point by crossing the viewing rays. If you knew the points, you could find each camera from what it sees. The photos alone cannot tell the size of the building, or where the world starts, so the answer is only fixed up to a move, a turn and a change of scale.
Definition
Input.
- images. For each image , an intrinsic matrix if the camera is calibrated, or nothing if it is not.
- tracks. Track is a set of observations : the scene point appears at the pixel in image . There are observations in all. Some observations can be wrong matches (outliers).
The camera frame has to the right, down and forward. A world point maps to the camera frame by with , to the pixel , where , and it is visible only if its depth is positive. The center of camera is .
Output. Camera parameters for as many images as possible and a point for as many tracks as possible, such that the inlier observations satisfy with positive depth, and a list of the observations judged to be outliers.
Cost. With independent Gaussian pixel noise of equal variance, the maximum likelihood answer minimizes
over all inlier observations. This is bundle adjustment. A structure from motion method is judged by whether it finds the right inlier set and a start in the basin of the global minimum of .
Ambiguity. If is a solution, so is the transformed scene with the cameras , , for any rotation , scale and shift , since and ignores the factor . So calibrated SfM has a 7-parameter family of equal answers (theorem). For uncalibrated cameras the family is the 15-parameter group of projective maps of space: and give the same images for any invertible matrix (theorem). The projective reconstruction theorem states that, for two views in general position, this is the only ambiguity. The outputs are compared only after one fixes the gauge, for example , and one distance set to 1.
Variants
- Calibrated or uncalibrated. With known , the result is metric up to a similarity. With unknown , the direct result is projective, and self-calibration or a stratified reconstruction upgrades it to a metric one.
- Affine cameras. When the scene depth is small compared with the distance, the affine camera model applies, the projection becomes linear, and the Tomasi-Kanade factorization solves the problem in closed form if all points are seen in all images.
- Ordered or unordered images. A video gives images in time order with small motion between frames, which is the setting of visual odometry and SLAM. An Internet photo collection has no order, so the pairs that overlap must first be found, for example by image retrieval, and stored in a view graph.
- Full or missing data. In the full data case, every point is seen in every image, and the measurement matrix is complete. Real data has a sparse pattern of visibility, which rules out the plain factorization methods.
- Other features. Lines, planes, or known objects can replace points, and other sensors (GPS, an inertial unit) can add constraints on the cameras.
- Rolling shutter and moving objects. A rolling shutter gives each image row its own pose, and a non-rigid scene breaks the model; both need extended models.
Examples
- Two calibrated views. The essential matrix from five or more matches gives the relative pose with ; the five-point algorithm gives at most 10 solutions for 5 matches (theorem). Triangulation then gives the points. The size of the scene stays unknown, which is the scale part of the gauge.
- A small synthetic scene. The reference test of incremental structure from motion has 5 cameras at a distance of about 5 from 40 points in a cube of side 2, 160 observations with 0.5 pixel noise and 5% of the observations replaced by random pixels. The pipeline registers all 5 cameras, keeps 36 points and 138 observations, and its points agree with the truth to 0.034 after a similarity alignment (a benchmark result on this scene).
- Pure rotation. If all images are taken from one center, the images are related by homographies, the rays of a point never cross at a finite angle, and no depth can be recovered. This is a degenerate input, not a hard instance.
- A counting argument. Each observation gives 2 equations, and a calibrated scene has free parameters after the gauge. So is necessary for a finite set of solutions in general position (a counting argument). Ullman (1979) showed that 3 orthographic views of 4 non-coplanar points fix the structure up to a mirror reflection (theorem).
Known algorithms
- Incremental structure from motion: start from a good pair, then add images one at a time by PnP, triangulate new points and run bundle adjustment after each step. It is the method of Bundler (Snavely, Seitz and Szeliski 2006) and COLMAP (Schönberger and Frahm 2016).
- Global structure from motion: estimate the relative poses of all overlapping pairs, solve rotation averaging and then translation averaging for all cameras at once, triangulate, and run bundle adjustment once.
- Tomasi-Kanade factorization: affine cameras and full data, by a rank 3 SVD and a metric upgrade.
- Sturm-Triggs factorization: perspective cameras and full data, by projective depths from fundamental matrices and a rank 4 SVD.
- Bundle adjustment, for example by sparse bundle adjustment, refines the result of any of these methods.
- Hierarchical methods split the images into clusters, reconstruct each cluster and merge the parts by similarity transforms; they sit between the incremental and the global methods.
| Algorithm | Time | Space | Properties | Code |
|---|---|---|---|---|
| Global structure from motion | O(N m + N^3) total | O(N^2 + m) extra | randomizediterativelocalnot monotoneiterative | 1 language |
| Incremental structure from motion | O(N^2 m + N^4) total | O(N^2 + m) extra | randomizediterativelocalnot monotoneiterative | 1 language |
| Sturm-Triggs projective factorization | O(N n min(N, n)) total | O(N n) extra | deterministicnot iterativenot localnot monotoneiterative | 1 language |
| Tomasi-Kanade factorization | O(N n min(N, n)) total | O(N n) extra | deterministicnot iterativenot localnot monotoneiterative | 1 language |
Bounds
- Minimal problems. Two calibrated views need 5 point matches and give at most 10 relative poses (theorem). Two uncalibrated views need 7 matches and give 1 or 3 fundamental matrices (theorem). These are the sample sizes of RANSAC in SfM pipelines.
- No global optimality in general. The bundle adjustment cost is not convex, and no known algorithm finds its global minimum for general inputs in polynomial time. The practical methods are heuristics with a local refinement at the end.
- Convex subproblems. With known rotations and calibrations, each observation gives the constraint for the normalized point , and these constraints are linear in all and (theorem). Kahl and Hartley showed that the same problem with the maximum reprojection error as the cost is quasi-convex and can be solved to global optimality by bisection with second order cone programs (theorem).
- Critical configurations. Some scenes and camera paths admit more than one reconstruction that is not related by the gauge, for example points and centers on certain quadric surfaces; see critical configurations.
- Data size. A reconstruction reads all observations, so any method costs . Incremental methods with a full bundle adjustment after each image cost much more, which is why large systems run global or partial bundle adjustments.
Reductions
- To bundle adjustment. Given a start inside the basin of the global minimum and the right inlier set, SfM reduces to bundle adjustment, a nonlinear least squares problem.
- To averaging problems. The global approach splits SfM into rotation averaging over the view graph, translation averaging with the rotations fixed, and triangulation with all cameras fixed. Each of these is a smaller problem.
- To PnP and triangulation. With all points known, each camera is a perspective-n-point problem. With all cameras known, each point is a triangulation problem. Incremental SfM alternates these two, and bundle adjustment couples them.
- To pose graph optimization. In SLAM, the relative poses between keyframes form a pose graph, and pose graph optimization solves the same synchronization problem on camera poses without the points.
- From the affine case to low rank approximation. Under the affine camera model with full data, SfM is the best rank 3 approximation of the centered measurement matrix (theorem), which the singular value decomposition solves.
Applications
- 3D models of buildings, cities and cultural heritage sites from photo collections, as in Photo Tourism.
- Aerial photogrammetry and mapping from drone or aircraft images.
- Camera tracking for visual effects in film (match moving) and for augmented reality.
- Robot and vehicle localization, where the sequential form is visual odometry and visual SLAM.
- The camera poses that multi-view stereo needs to compute dense depth maps and surface meshes.
References
- Richard Hartley and Andrew Zisserman, Multiple View Geometry in Computer Vision, second edition, Cambridge University Press, 2004, Chapter 10, 3D reconstruction of cameras and structure (the reconstruction ambiguities and the projective reconstruction theorem) and Chapter 18, N-view computational methods
- Richard Szeliski, Computer Vision, Algorithms and Applications, second edition, Springer, 2022, Chapter 11, Structure from motion and SLAM
- Onur Özyeşil, Vladislav Voroninski, Ronen Basri and Amit Singer, A survey of structure from motion, Acta Numerica 26, 2017, 305-364, the whole survey (the problem statement, the ambiguities, the incremental and global pipelines, rotation and location estimation)
- Noah Snavely, Steven M. Seitz and Richard Szeliski, Photo tourism: exploring photo collections in 3D, ACM Transactions on Graphics 25(3), 2006, 835-846, the reconstruction section (structure from motion on unordered Internet photo collections)
- Johannes L. Schönberger and Jan-Michael Frahm, Structure-from-motion revisited, IEEE Conference on Computer Vision and Pattern Recognition (CVPR 2016), 4104-4113, the review of the problem and of the incremental pipeline
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.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W2 basic |
|
Tag FS0JBE Edit this page History Report an error Markdown