Epipole
Epipole is GPU Structure-from-Motion in C++17 and CUDA: 3D reconstruction from photos, with camera poses and a sparse point cloud, on an NVIDIA GPU or the CPU. Every stage has both versions, and they give the same results. No OpenCV, no Ceres.
What it does
Structure-from-Motion recovers where each photo was taken and a 3D model of the scene from the photos alone. Epipole does it the way COLMAP does, incrementally, with every stage in CUDA:
- Features: SIFT and ORB, bit-identical on the CPU and the GPU.
- Matching: exact top-2 (SIFT on the tensor cores), ratio test, 5-point E-RANSAC or F-RANSAC.
- Reconstruction: initial pair, PnP, multi-view triangulation, outlier filtering, local and global bundle adjustment with the Schur complement on the GPU; rigid multi-camera rigs.
- Viewer: watch a reconstruction run live, replay it, inspect cameras, compare two runs.
- Python:
epipole.reconstruct("photos/")returns camera poses and a coloured point cloud as NumPy arrays (pip install .). - Cameras: focal length from EXIF and refined; known or estimated radial lens distortion.
- Library: use it from your own C++ code (
sfm::pipeline::run_pipeline).
Results
| Dataset | Images | Registered | Rotation error (median) | COLMAP |
|---|---|---|---|---|
| Bunny (included) | 36 | 36 | 0.17° | 0.28° |
| ETH3D courtyard | 38 | 38 | 0.030° | 0.034° |
| ETH3D delivery_area, one camera | 237 | 237 | 0.20° | 0.46° |
| Middlebury templeRing | 47 | 47 | 0.13° | 0.18° |
| ETH3D delivery_area, four-camera rig | 948 | 948 | 0.09° | – |
Errors against each dataset's ground truth, with each dataset's tuned config. ETH3D and Middlebury data are not included in the repository.
CPU or GPU
| Config | Images | CPU | GPU | Speed-up |
|---|---|---|---|---|
| Bunny, ORB | 36 | 1.3 s | 0.62 s | 2.1× |
| Bunny, SIFT | 36 | 8.3 s | 0.79 s | 10× |
| Middlebury templeRing | 47 | 34 s | 3.4 s | 10× |
| ETH3D courtyard (1550×1032) | 38 | 245 s | 4.1 s | 60× |
| ETH3D delivery_area, one camera | 237 | 41 s | 6.5 s | 6× |
Ryzen 7 9700X (16 threads) against an RTX 5060 Ti; both give the same result on each. Measured with bench_stages (best of 3 after a warm-up; a single sfm_run of the bunny takes 0.9 s), default configs.
Against COLMAP
COLMAP 4.2.1 built with CUDA, on the bunny with the same masks and fixed intrinsics: 2.5 s and 0.28° (extraction, matching and mapping on the GPU), against 0.77 s and 0.17° here. On the CPU COLMAP takes 4.0 s, Epipole 8.3 s.
Get started
git clone https://github.com/Sovik-Ghosh/sfm-cuda.git
cd sfm-cuda
cmake --preset release && cmake --build --preset release -j # CUDA 13, RTX 20xx to 50xx
# or, without an NVIDIA GPU: cmake --preset cpu && cmake --build --preset cpu -j
./build/release/inference/apps/sfm_run configs/bunny_sift_tuned2.json
./build/release/inference/apps/sfm_viewer outputs/bunny-sift-tuned2
# your own photos: any names, portrait and landscape, focal length from EXIF
./build/release/inference/apps/sfm_run --images path/to/photos
# or from Python
pip install . && python -c "import epipole; print(epipole.run('configs/bunny_sift_tuned2.json').metrics)"
Prebuilt Linux binaries (CPU-only and CUDA) are attached to the
latest release. Your own photos:
sfm_run --images on a folder of JPEGs (portrait and landscape, focal length from EXIF); see
Use your own images.
"colmap_scene": true writes the images/ + sparse/0 folder that
3D Gaussian Splatting and nerfstudio open directly.