# Direct Sparse Odometry

Direct Sparse Odometry drops the smoothness prior and still tracks more accurately

Jakob Engel, Vladlen Koltun, Daniel Cremers · arXiv · 2016-7-9

- **Problem** Direct methods add a smoothness prior over geometry, which makes a consistent joint solve of geometry and camera motion too expensive for real time.
- **Method** Direct Sparse Odometry drops the geometric prior and samples pixels evenly across the image. It jointly optimizes poses and inverse depths by minimizing photometric error in a sliding window.
- **Results** On the TUM monoVO dataset, Direct Sparse Odometry is more accurate and robust than ORB-SLAM, and runs at 5 times real-time speed.

## Why geometry priors make joint optimization hard

Dense and semi-dense direct methods usually add a smoothness prior over neighbouring geometry, because a dense model cannot be pinned down from passive vision alone without it. The prior enters the energy as an extra log-likelihood term, which links the geometry of neighbouring pixels to one another.

Those links fill the geometry-geometry block of the Hessian with off-diagonal entries, so the system grows and becomes much harder to solve. Without a special structure, a statistically consistent joint solve of poses and geometry is hard to run in real time, which is why existing dense approaches neglect or approximate part of these correlations.

The authors also observed that such priors can bias the estimate, so that denser and visually smoother reconstructions can lose long-term, large-scale accuracy.

This work drops the geometric prior. Geometry parameters are then conditionally independent given the poses and intrinsics, and pixels are sampled across the image instead of only keypoints, so edges and weakly textured regions can contribute.

## The photometric residual over a small pixel pattern

Each point is scored in a reference frame against an observing target frame over a pattern of 8 pixels, and the pattern is slightly spread so that it balances computation, robustness to motion blur and information content. A neighbourhood of this size carries roughly the same information as adding first- and second-order irradiance derivative constancy terms to the central pixel.

For a pixel in the pattern, the residual compares the target intensity at the projected location with the reference intensity, after both are corrected for exposure and brightness transfer:

\\\[ r\_p = \\big(I\_j\[p'\] - b\_j\\big) - \\frac{t\_j e^{a\_j}}{t\_i e^{a\_i}}\\big(I\_i\[p\] - b\_i\\big) \\\] The energy applies a Huber norm to each residual and multiplies it by the gradient-dependent weight, where the Huber norm is the robust penalty used for the photometric terms.

The weight shrinks as the squared image gradient at the pixel grows, with a constant c setting the scale, so high-gradient pixels contribute less. The authors interpret this weight as the effect of small independent geometric noise on p' that has been marginalized, which approximates a small geometric error.

The brightness transfer is an affine term \\( e^{-a\_i}(I\_i-b\_i) \\) whose scale is parametrized logarithmically, which keeps the factor positive and avoids the exponential drift that a multiplicative parametrization would allow. The authors note that a maximum-likelihood estimate of a multiplicative factor is biased when both inputs are noisy, so without a prior the factor can drift when the scene is unconstrained.

The full photometric energy sums the pair residuals over all frames, all points hosted in each frame and all frames that observe each point: \\\[ E\_{photo} = \\sum\_{i\\in F}\\sum\_{p\\in P\_i}\\sum\_{j\\in obs(p)} E\_{pj} \\\]

When exposure times are known, an extra prior pulls the affine brightness parameters toward zero: \\\[ E\_{prior} = \\sum\_{i\\in F}\\left(\\lambda\_a a\_i^2 + \\lambda\_b b\_i^2\\right) \\\]

A point has one unknown, its inverse depth in the reference frame, instead of the three coordinates an indirect method estimates, because a direct point is simply the place where the reference pixel's ray meets the surface. That parametrization also fits the uncertainty of stereo-based depth, especially for far-away points, in a Gaussian framework.

## Photometric correction before tracking

For wide-angle lenses this reduces the field of view, but it lets the method be compared with methods that support only a limited set of camera models.

Pixel intensity is modeled as a non-linear response G applied to exposure-scaled, vignetted irradiance: \\\[ I\_i(x) = G\\big(t\_i V(x) B\_i(x)\\big) \\\] Here B\_i is the irradiance, t\_i the exposure time and V the vignetting function. Each frame is corrected by inverting G and compensating for V before any other step, and the corrected image is what the rest of the method calls I\_i.

Exposure changes strongly within one sequence. The example used in the paper ranges from 0.018 to 10.5ms, a factor of more than 500. The authors model these quantities explicitly rather than treating them as unknown noise.

When no photometric calibration is available, as for EuRoC MA V, the exposure is set to 1 and the prior weights are set to zero, so the affine brightness term absorbs the changing exposure.

## Sliding-window Gauss-Newton and marginalization

The total photometric energy is minimized over a sliding window with Gauss-Newton. Each residual is evaluated at the current estimate, and the system is built from the stacked Jacobian and residual: \\\[ H = J^T W J, \\qquad b = -J^T W r \\\]

Each new keyframe triggers up to 6 Gauss-Newton iterations, which stop early once the increment is small. The method uses no Levenberg-Marquardt damping, since it never starts far from the minimum.

Pose parameters live on SE(3), so updates accumulate in a tangent space around a linearization point ζ0. That point is fixed for a variable once the variable enters the marginalization term, and it is reset for the other variables after each update.

The Jacobians are evaluated at zero increment, which the authors call First Estimate Jacobians. Re-linearizing at different points would add spurious information along the non-linear null spaces, here absolute pose and scale. The image-gradient factor is recomputed at the current increment with centred differences at integer positions and bilinear interpolation, and the geometric Jacobian is shared by the 8 residuals of a point, evaluated at the centre pixel.

When the window is full, old frames and points are removed by marginalization, which uses the Schur complement. Residuals that would change the sparsity pattern of H are dropped: the points hosted in the frame, points not observed in the last two keyframes and remaining observations of active points in that frame.

The energy to be removed is approximated by a quadratic in the increment around the current estimate. The Schur complement then yields the reduced quadratic on the kept variables: That quadratic stays in the system as an added prior, and it requires the tangent space of the kept variables to stay fixed during later steps.

## Frame tracking and keyframe decisions

A new frame is tracked against a single keyframe with two-frame direct image alignment, using a multi-scale pyramid and a constant motion model for initialization. Denser depth maps brought little gain in accuracy or robustness but cost noticeably more runtime, so the density stays limited.

Keyframes are first created at around 5-10 per second and then thinned out by marginalization, following the same idea as ORB-SLAM. Three indicators decide whether a frame becomes a keyframe: the mean flow f from the last keyframe, the mean flow without rotation f\_t, and the relative brightness factor a. A keyframe is created when \\( w\_f f + w\_{ft} f\_t + w\_a a \> T\_{kf} \\), with T\_kf = 1 by default.

The score is defined as: \\\[ s(I\_i) = \\sqrt{d(i,1)} \\sum\_{j\\in\[3,n\]\\setminus\\{i\\}} \\big(d(i,j)+\\epsilon\\big)^{-1} \\\] It favours keyframes that stay spread through 3D space and keep more keyframes near the newest one, and the authors designed it heuristically.

## Choosing and activating points

Rather than use every pixel, the method keeps a fixed budget of 2000 active points spread over space and active frames, and it selects 2000 candidate points in each new keyframe. The authors argue that image data is highly redundant, so more points quickly stop helping.

The image is split into 32 × 32 blocks, and each block gets an adaptive threshold: the median absolute gradient in the block plus a global constant g\_th, which is 7 in the default setting. The image is then split into d × d blocks, and in each block the pixel with the largest gradient is kept if it passes the threshold. Two more passes use blocks of 2d and 4d and lower thresholds, which adds points in regions with weak intensity variation.

The block size d is adapted so that the desired number of points is reached. Candidate selection uses the raw images before photometric correction.

Candidates are tracked in later frames by a discrete search along the epipolar line that minimizes the photometric error. The best match gives a depth and a variance that narrows the search in the next frame, a strategy inspired by LSD-SLAM.

Activation picks candidates that are far from existing active points when projected into the most recent keyframe, and candidates from the second and third passes must lie at a larger distance.

Two checks remove bad points early. A candidate is discarded when the minimum along the epipolar line is not sufficiently distinct, and an observation is removed when its photometric error exceeds a threshold that adapts to the median residual of its frame.

## Datasets and how runs were counted

The TUM monoVO dataset provides 50 photometrically calibrated sequences with 105 minutes of video. Its tracking error is the alignment error, because only loop-closure ground truth is provided. The EuRoC MA V dataset contains 11 stereo-inertial sequences with 19 minutes of video, and it is evaluated with absolute trajectory error after Sim(3) alignment.

The ICL-NUIM dataset contains 8 ray-traced sequences with 4.5 minutes of video from two indoor environments, also evaluated with absolute trajectory error.

Each sequence is run forwards and backwards, and the runs are repeated to account for non-deterministic behaviour. This gives 500 runs on TUM monoVO, 220 runs on EuRoC MA V and 80 runs on ICL-NUIM. Real-time execution is not enforced for most runs, and the authors state that DSO runs about four times slower than real time in its sequentialized, single-threaded form.

ORB-SLAM is played back at 20% speed.

For a fair comparison, explicit loop-closure detection and re-localization are disabled for ORB-SLAM, while local and global bundle adjustment remain active. On ICL-NUIM the gradient threshold g\_th is set to 3 for DSO, and the FAST threshold of ORB-SLAM is lowered to 2.

## DSO against ORB-SLAM

On the TUM monoVO dataset DSO has higher accuracy and robustness than ORB-SLAM, both in the sequential non-real-time runs and in the hard-enforced real-time runs on an Intel i7-4910MQ CPU. The same ordering holds on the synthetic ICL-NUIM dataset.

On EuRoC MA V, ORB-SLAM reaches a better absolute trajectory error than DSO, but it is less robust. The authors attribute this to two causes: no photometric calibration is available for that dataset, and the sequences contain many small loops and back-tracking segments that the local mapping of ORB-SLAM closes implicitly, whereas DSO marginalizes all points and frames that leave the field of view.

When ORB-SLAM is prevented from matching keypoints not observed within t\_max = 10s, its accuracy becomes similar to DSO's, while it stays less robust.

## Reduced settings at five times real time

With Np = 800 points, Nf = 6 active frames, 424×320 image resolution and at most 4 Gauss-Newton iterations after a keyframe is created, DSO runs at 5 times real-time speed. The authors report very good accuracy and robustness with these settings on all three datasets.

DSO is designed as a pure visual odometry method, while ORB-SLAM is a full SLAM system with loop-closure detection and re-localization, and these abilities were switched off for the comparison.

## What the photometric calibration contributes

The components are disabled incrementally: exposure, then vignetting, then the response function, and finally the brightness constancy assumption, with the affine brightness correction turned off.

Known exposure times have little effect on accuracy, while removing vignetting and response calibration slightly lowers the overall accuracy.

## More points and frames add density, not accuracy

The optimization window was varied over several values of N\_f, and the number of points N\_p was varied from 50 to 10000 on TUM monoVO. Using more than N\_p = 500 points or N\_f = 7 active frames has only a marginal impact on accuracy, and the default N\_p = 2000 is chosen mainly for denser reconstructions.

Point clouds and coarse depth maps for N\_p = 500, 2000 and 10000 show that the number of points mainly changes the density of the reconstruction. The authors conclude that simply using more data does not increase tracking accuracy, although it makes the 3D models denser.

## Geometric and photometric noise

Geometric noise is not modeled in the direct approach, so it has a much stronger effect there. For a geometric noise level above 1.5 there is likely no state for which all residuals lie within the validity radius of the linearization, and optimization fails entirely. This suggests the direct model is more sensitive to inaccurate intrinsic calibration than the indirect approach, and it may benefit more from non-parametric intrinsic calibration.

For photometric noise, a random blur map is applied as an anisotropic Gaussian blur to each frame.

Overall the authors conclude that the indirect model is superior on smartphone or off-the-shelf webcam data, while the direct approach is superior on data from dedicated machine-vision cameras, where geometric precision matters more. The authors note that tightly integrating the rolling shutter into the model could resolve the geometric-noise weakness, as done in other work, but this paper does not do it.

## Limitations

Under large geometric noise, such as a rolling shutter or inaccurate intrinsics, the direct model fails much earlier than the indirect model, and at high levels optimization fails entirely.

The evaluation compares DSO only with ORB-SLAM, because LSD-SLAM and SVO failed on most sequences in the authors' runs. DSO has no loop-closure detection or re-localization, so the comparison leaves those abilities of ORB-SLAM out.

On EuRoC MA V, ORB-SLAM keeps the better accuracy, and the authors link this partly to the missing photometric calibration. The authors also note that a tightly integrated IMU would likely make the RANSAC-like recovery step unnecessary, and this paper does not use an IMU.

The method is limited to monocular, pinhole-model video after radial distortion removal, and the authors expect that the greatly increased non-convexity of the photometric energy restricts the use of the model to video processing.

## Paper info

- **Authors**: Jakob Engel, Vladlen Koltun, Daniel Cremers
- **Venue**: arXiv · Preprint
- **First published**: 2016-7-9
- **Added**: 2026-11-12
- **Updated**: 2016-10-7
- **Version**: v2
- **arXiv**: 1607.02565
- **Category**: cs.CV
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1607.02565v2) · [PDF ↗](https://arxiv.org/pdf/1607.02565v2)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Quote from the paper

Jakob Engel, Vladlen Koltun, Daniel Cremers (2016). Direct Sparse Odometry. arXiv:1607.02565v2. https://arxiv.org/abs/1607.02565v2

**BibTeX**

```
@misc{engel2016direct,
  title = {{Direct Sparse Odometry}},
  author = {Jakob Engel and Vladlen Koltun and Daniel Cremers},
  year = {2016},
  eprint = {1607.02565},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1607.02565v2}
}
```

## Related papers

- [NeRF-SLAM: Real-Time Dense Monocular SLAM with Neural Radiance Fields](https://refivu.com/en/papers/00ff6632-386d-4846-bfdb-98c18566d9ed-nerf-slam-real-time-dense-monocular-slam-with.md)
- [Unsupervised Learning of Depth and Ego-Motion from Video](https://refivu.com/en/papers/c545cc84-bdea-4ac2-ba9d-bf5f4a19568c-unsupervised-learning-of-depth-and-ego-motion-from.md)
- [Polygraph: Large-Scale Multi-Session Trajectory Optimization using Pose Graphs](https://refivu.com/en/papers/05c4e863-0276-4159-8579-6702d3b03259-polygraph-large-scale-multi-session-trajectory-optimization.md)

## Other paper commentary

- [Sparse Subspace Clustering: Algorithm, Theory, and Applications](https://refivu.com/en/papers/cf801d50-c51a-4e90-bfdb-a39a2831b982-sparse-subspace-clustering-algorithm-theory-and-applications.md)
- [Pruning Filters for Efficient ConvNets](https://refivu.com/en/papers/54826eca-5fee-4b64-b058-a4fcd92f8178-pruning-filters-for-efficient-convnets.md)
- [Knowledge Distillation: A Survey](https://refivu.com/en/papers/20b6ef99-85b3-42b7-9c02-384c6383f2ff-knowledge-distillation-a-survey.md)
- [Efficient Processing of Deep Neural Networks: A Tutorial and Survey](https://refivu.com/en/papers/587cab8c-6795-4edf-94db-5f485a9b553b-efficient-processing-of-deep-neural-networks-a-tutorial.md)
- [Quantization and Training of Neural Networks for Efficient Integer-Arithmetic-Only Inference](https://refivu.com/en/papers/07bb92b6-cd63-4ab5-ab99-88473c074df7-quantization-and-training-of-neural-networks-for-efficient.md)
- [Federated Learning: Strategies for Improving Communication Efficiency](https://refivu.com/en/papers/f21e9a4b-b86a-4954-8c8a-ed4ff256e5d6-federated-learning-strategies-for-improving-communication.md)
- [Self-Attention with Relative Position Representations](https://refivu.com/en/papers/9457d4e9-5650-4947-91f7-51a786a383f6-self-attention-with-relative-position-representations.md)
- [On First-Order Meta-Learning Algorithms](https://refivu.com/en/papers/96fdc3b8-b749-4c6d-ac7d-17c8789f25d8-on-first-order-meta-learning-algorithms.md)
- [RAFT: Recurrent All-Pairs Field Transforms for Optical Flow](https://refivu.com/en/papers/14ee65d7-abd3-40c2-af3a-dcf58b84facf-raft-recurrent-all-pairs-field-transforms-for-optical.md)
- [StackGAN: Text to Photo-realistic Image Synthesis with Stacked Generative Adversarial Networks](https://refivu.com/en/papers/5f81473c-85d8-4d1a-acd2-1cc917ea3535-stackgan-text-to-photo-realistic-image-synthesis-with.md)
- [Adversarial Machine Learning at Scale](https://refivu.com/en/papers/fcc0e603-ae52-4f86-b341-4b1f8ee7d840-adversarial-machine-learning-at-scale.md)
- [LexRank: Graph-based Lexical Centrality as Salience in Text Summarization](https://refivu.com/en/papers/11b54298-bb68-4667-a225-10b7dade3a5a-lexrank-graph-based-lexical-centrality-as-salience-in.md)

## Terms in this paper

- [Hessian](https://refivu.com/en/terms/cb53640b58ff-hessian)
- [keyframe](https://refivu.com/en/terms/e370272d4f67-keyframe)
- [factor graph](https://refivu.com/en/terms/55511b3924ef-factor-graph)
- [inverse depth](https://refivu.com/en/terms/9fa9beaaf4ed-inverse-depth)
- [Marginalization](https://refivu.com/en/terms/e99811d34d08-marginalization)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/05fea2ab-dd17-4852-b079-020caac4ff45-direct-sparse-odometry)
