The same pipeline, engineered
Every stage of COLMAP corresponds to a step of Structure from Motion. The table lines them up.
The differences are in scale and robustness. COLMAP matches thousands of photos, scores which view to add next instead of taking the next one in order, triangulates each point from its whole track of photos, and keeps adjusting the intrinsics. You fixed the intrinsics to the reference values. COLMAP estimates them from the photos alone, which is what you need for a phone or camera you have never calibrated.
Genuinely different approaches to the same problem exist. Global structure from motion, such as GLOMAP, estimates all camera rotations at once and then all positions, instead of growing the model one view at a time (Pan et al., 2024). Learned methods such as VGGT and MASt3R-SfM predict camera poses and dense geometry directly from the photos with a network, and often feed the result to bundle adjustment.
Code
Code
The scene and the reference model
The photos are the garden scene of the Mip-NeRF 360 dataset, 185 photos taken while walking around a table, here at one eighth of their size. The dataset ships with a COLMAP reconstruction of all 185 photos, made by the dataset’s authors from the full-size images. Nobody reran it here. It serves as the reference that both your own reconstruction and the run below are compared with.Code
Code
Running COLMAP on twelve photos
The run uses photos 21 to 32 in name order, the same twelve as Structure from Motion. It has three stages. Feature extraction finds up to 8192 SIFT features per photo, with affine-adapted shapes and descriptors pooled over several scales, which makes matches more reliable under changes of viewpoint. Matching compares every pair of photos, keeps a match only if it passes the ratio test at 0.8 and is the mutual nearest neighbor in both directions, then verifies each pair geometrically. Mapping grows the reconstruction. It discards points whose reprojection error exceeds 4 pixels and refines the focal length, the principal point and one radial distortion coefficient together with the poses. All twelve photos share one camera, because one camera took them all. The model is simple radial: one focal length, a principal point and one distortion coefficient. Unlike your reconstruction, this run is not told the intrinsics.Code
Code
Comparison with the reference
COLMAP’s twelve cameras live in their own gauge, so the comparison first finds the similarity transform that maps their centers onto the reference centers of the same twelve photos (the Umeyama method). It then compares positions, orientations and the estimated camera.Code
Code
Choosing which pairs to match
Matching is usually the most expensive stage, because the number of candidate pairs grows quickly with the number of photos. COLMAP offers several ways to choose the pairs:- Exhaustive matching tries every pair, of them. It suits unordered photo sets of up to a few hundred images, because it cannot miss an overlap.
- Sequential matching tries each photo only against the next in capture order, about pairs. It suits video and walk-around captures, where neighbors in time are neighbors in space. A loop-detection option adds pairs that a visual vocabulary flags as similar, so that returning to the starting point closes the loop.
- Vocabulary tree matching retrieves the most similar photos for each photo, for very large unordered sets.
- Spatial matching pairs photos whose GPS or other position priors are close.
Code
Code
Cameras for your own photos
COLMAP describes each physical camera by a model and its parameters. The common models are:
How cameras are shared between photos matters as much as the model. There are three choices. One camera for all photos is right when one device with fixed zoom and focus took them all; it gives bundle adjustment the most observations per intrinsic parameter. One camera per photo is right only when every photo really comes from a different device or zoom setting, because each photo then has to pin down its own intrinsics. One camera per source, such as one for the still photos and one for each video resolution, is right for a capture that mixes devices or image sizes.
A mixed capture needs one camera per source because a single shared camera cannot describe images of different sizes, and photos that do not fit the shared camera fail to register. Giving every photo its own camera registers them, but the many separate intrinsics are poorly constrained and slow down whatever reads the model next.
Never rewrite the intrinsics after bundle adjustment, for example by merging many refined cameras into a few afterwards. Bundle adjustment optimized every pose jointly with the intrinsics it had at the time. Swapping in different intrinsics leaves each pose wrong for its new camera, and the error shows up later as blurry reconstructions and poor results on held-out views. Decide the sharing before reconstruction, and let bundle adjustment refine the shared cameras.
A few capture rules make reconstruction work the first time:
- Lock exposure and focus, so that the same surface has the same brightness in every photo.
- Overlap neighboring photos by about 70%, so that every point appears in several of them.
- Walk several loops at different heights around the subject, so that triangulation angles are large and the whole object is seen.
- Keep the scene still. Anything that moves between photos breaks the assumption that one 3D point explains all of its observations.
Output files and conventions
A reconstruction is three files, written in binary (.bin) or text (.txt) form with the same content. cameras holds one line per camera: its model, image size and parameters. images holds two lines per photo: the pose and camera of the photo, then the 2D keypoints with the ID of the 3D point each one observes. points3D holds one line per point: its position, color, mean reprojection error and the track of photos that see it.
Code
Code
Code
Code
Grounding the frame in world coordinates
COLMAP has its own steps for fixing the gauge from outside information.
Alignment to known camera positions is the same Umeyama similarity transform that the comparison above and Structure from Motion use, run inside RANSAC so that a few bad positions cannot pull it off. COLMAP reports the mean and median camera-center error after the fit. For a robot, the positions can be camera poses from the arm’s forward kinematics, or markers measured in the robot’s base frame, and the transform then moves every camera and point into robot coordinates. The steps differ in what they can recover. Gravity alone fixes the rotation and leaves scale and translation free. Metric scale needs at least one real distance or known positions. All seven degrees of freedom need at least three known positions that do not lie on a line. When the robot itself is in the scene, its own geometry can serve as the reference. Registering a Scan to the Robot covers that case and how published real-to-sim systems handle it.
The cell below aligns the twelve-photo model to the reference camera positions in the same robust way. The reference plays the part of the outside measurements.
Code
Code
References
- Pan, L., Baráth, D., Pollefeys, M., Schönberger, J. (2024). Global Structure-from-Motion Revisited. arXiv [cs.CV]. Link
Found an error on this page? Report an issue.

