This repository includes colmap-odometry as a git submodule in third_party/colmap-odometry. Clone with --recursive to fetch it too:
git clone --recursive https://github.com/lcmrl/cslam.gitIf you already cloned without --recursive, initialize the submodule with:
git submodule update --init --recursiveFor compatibility, the submodule is pinned to a specific commit of colmap-odometry:
| Submodule | Commit | Date |
|---|---|---|
| colmap-odometry | fdcfbce |
2026-11-10 |
To check that you have the pinned version, run:
git submodule status
# expected: fdcfbce53e85bcd6e139fa9b252e1ba16eadff98 third_party/colmap-odometryIf the hash is different, or has a + in front of it, restore the pinned commit with git submodule update --init --recursive.
git submodule update --init --recursive always checks out this exact commit, so later upstream changes won't affect this repository. Do not use git submodule update --remote unless you intend to move to a newer, possibly incompatible, version. If you do, check that everything still works before committing the new pointer.
For installing colmap-slam, we recommend using uv for fast and reliable package management:
# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh
# Create and activate a virtual environment
uv venv --python 3.10
source .venv/bin/activate # On Windows: .venv\Scripts\activateThen, you can install colmap-slam using uv:
uv pip install -e .This command will install the package in editable mode, allowing you to modify the source code and see changes immediately without needing to reinstall. If you want to use colmap-slam as a non-editable library, you can also install it without the -e flag.
Install pytorch from https://pytorch.org/ to have GPU support.
Run colmap-odometry on the sample CARLA dataset in assets/:
python cslam.pyBy default, cslam.py uses the sample images in assets/ and the files in config/ and calibration/, and writes the results to ./output. Each of these can be overridden:
python cslam.py -i path/to/images -c path/to/config.yaml -a path/to/calibration.yaml -r path/to/camera_rig.yaml -w path/to/outputAdd --gui to plot the estimated trajectory live (top view, X–Z plane) while colmap-odometry is running. When processing ends, the window stays open until you close it:
python cslam.py --guiThe images folder must contain one subfolder per camera (e.g. cam0, cam1). The trajectory is saved in the output folder as trajectory.txt and images.txt (COLMAP format). trajectory.txt has a header and one line per frame, with the camera-to-world pose: the camera center (tx ty tz) and the camera orientation in world (qw qx qy qz):
# image_name tx ty tz qw qx qy qz cov
0013.jpg -0.0076 0.0082 0.8767 0.99999 0.00016 0.00012 0.00032 0.0142
cov is the norm of the translation standard deviations estimated by colmap-odometry (999 if not available). Run python cslam.py --help for all options.
If you pass a GNSS file, the trajectory is refined once colmap-odometry has finished. This uses a gtsam pose graph built from the colmap-odometry relative poses and the GNSS positions:
python cslam.py --gnss assets/gnss.txtThe GNSS file has one line per image: image_name x y z (any extra columns are ignored). Images are matched to frames by file name. If the GNSS positions are in a different frame from the odometry, the odometry is rigidly aligned to them before optimizing. Default uncertainties (standard deviations) are 0.05 m for GNSS, plus 0.01 rad and 0.05 m for each odometry step. You can change them with --gnss_sigma, --odom_sigma_rot and --odom_sigma_trans. The result is saved as trajectory_optimized.txt (same format as trajectory.txt, without cov) and images_optimized.txt. With --gui, the GNSS points and the optimized trajectory are added to the plot.
@article{morelli2025deep,
title={Deep Learning in Visual Odometry for Autonomous Driving},
author={Morelli, Luca and Tryba{\l}a, Pawe{\l} and Razzino, Armando Vittorio and Remondino, Fabio},
journal={The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences},
volume={48},
pages={93--99},
year={2025},
publisher={Copernicus GmbH}
}@article{morelli2023colmap,
title={COLMAP-SLAM: A framework for visual odometry},
author={Morelli, Luca and Ioli, Francesco and Beber, Raniero and Menna, Fabio and Remondino, Fabio and Vitti, Alfonso},
journal={The International Archives of the Photogrammetry, Remote Sensing and Spatial Information Sciences},
volume={48},
pages={317--324},
year={2023},
publisher={Copernicus Publications G{\"o}ttingen, Germany}
}