Geometry-Aware Dense Reconstruction from Sparse Structure-from-Motion
GeoFuse-SFM is a modular Structure-from-Motion pipeline that produces sparse 3D reconstructions from multi-view images. It supports both calibrated multi-camera rigs (like the BBM dataset) and sequential single-camera captures (like the Fountain dataset). The sparse reconstruction serves as seed geometry for downstream dense fusion.
- Unified Pipeline - Single codebase handles both multicam and singlecam setups
- Textureless Surface Support - Adaptive SIFT parameters for smooth/plastic objects
- Calibrated Rig Support - Leverages known camera poses for multicam datasets
- Modular Architecture - Clean separation of matching, triangulation, BA, and cleanup
- Configurable - All parameters in dataclass configs with presets
- Silhouette Integration - Contour matching + filtering for challenging objects
git clone https://github.com/yourusername/geofuse-sfm.git
cd geofuse-sfm
pip install -r requirements.txtMulticam (calibrated rig):
python -m scripts.run_multicam \
--images_dir Data/bird/images \
--cameras_dir Data/bird/calib \
--masks_dir Data/bird/silhouettes \
--feature_preset textureless \
--visualizeSinglecam (sequential images):
python -m scripts.run_multicam \
--images_dir Data/fountain/images \
--K_file Data/fountain/K.txt \
--visualizeoutput/<scene_name>/
โโโ sparse_points.ply # Sparse point cloud
โโโ checkpoint_sfm.pkl # Full reconstruction state
โโโ sfm_diagnostics/ # Per-stage diagnostics
โโโ all_proj_overlays/ # Reprojection visualizations
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ GeoFuse-SFM Pipeline โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ โ
โ โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ โ
โ โ Images โ โ K / Camsโ โ Masks โ (optional) โ
โ โโโโโโฌโโโโโ โโโโโโฌโโโโโ โโโโโโฌโโโโโ โ
โ โ โ โ โ
โ โผ โผ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ FEATURE EXTRACTION โ โ
โ โ SIFT with configurable contrast (textureless preset) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ PAIRWISE MATCHING โ โ
โ โ Multicam: Epipolar filter + Contour matching โ โ
โ โ Singlecam: E-RANSAC verification โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ TRACK BUILDING โ โ
โ โ Union-find to link matches across views โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ INITIALIZATION โ โ
โ โ Select best pair โ Triangulate seed points โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ INCREMENTAL REGISTRATION โ โ
โ โ For each image: โ โ
โ โ โข PnP pose estimation (singlecam) โ โ
โ โ โข Use known pose (multicam) โ โ
โ โ โข Triangulate new points (min 3 views for multicam) โ โ
โ โ โข Local bundle adjustment (singlecam only) โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ OUTLIER REMOVAL โ โ
โ โ Strict reprojection filter + Spatial filter โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ OUTPUT โ โ
โ โ Sparse point cloud + Camera poses + Tracks โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ โ
โ โผ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ DENSE FUSION (Coming Soon) โ โ
โ โ Seed-based depth propagation using sparse geometry โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
geofuse-sfm/
โโโ src/
โ โโโ pipeline/ # Core SfM pipeline modules
โ โ โโโ config.py # Configuration dataclasses
โ โ โโโ state.py # Reconstruction state management
โ โ โโโ matching.py # Feature extraction & matching
โ โ โโโ triangulation.py # Multi-view triangulation
โ โ โโโ initialize.py # Initial pair selection
โ โ โโโ registration.py # Incremental image registration
โ โ โโโ ba_runner.py # Bundle adjustment
โ โ โโโ cleanup.py # Outlier removal
โ โโโ features.py # SIFT/ORB feature detection
โ โโโ tracks.py # Track building (union-find)
โ โโโ geometry.py # Geometric utilities
โ โโโ ba.py # Bundle adjustment solver
โ โโโ diagnostics/ # Analysis & statistics
โ โโโ filter_utils/ # Outlier filtering
โ โโโ geometry_utils/ # Projection, triangulation helpers
โ โโโ mulitcam_utils/ # Multicam-specific utilities
โ โโโ visualization/ # Overlay generation
โโโ datasets/
โ โโโ multicam.py # Multicam dataset loader
โ โโโ singlecam.py # Singlecam dataset loader
โโโ data_io/
โ โโโ camera.py # Camera I/O & decomposition
โ โโโ images.py # Image loading utilities
โ โโโ pointcloud_io.py # PLY export
โโโ scripts/
โ โโโ run_multicam.py # Main runner script
โโโ utils/
โ โโโ checkpoint.py # Checkpoint save/load
โ โโโ logging_utils.py # Logging utilities
โโโ docs/
โโโ assets/ # Documentation images
All parameters are organized in dataclass configs:
from src.pipeline import SfMConfig, get_textureless_config
# Use a preset
config = get_textureless_config()
# Or customize
config = SfMConfig()
config.matching.feature.sift_contrastThreshold = 0.004 # For textureless
config.triangulation.min_views_accept = 3 # Require 3 views
config.ba.mode = "local+global_end" # Enable BA| Preset | Use Case | SIFT Contrast |
|---|---|---|
default |
Textured scenes (buildings, outdoor) | 0.04 |
textureless |
Smooth surfaces (plastic, skin) | 0.004 |
high_detail |
Maximum feature extraction | 0.02 |
python -m scripts.run_multicam --feature_preset textureless ...| Dataset | Type | Cameras | Status |
|---|---|---|---|
| Fountain | Singlecam | 11 | โ Working |
| TempleRing | Singlecam | 47 | โ Working |
| Bird (BBM) | Multicam | 27 | โ Working |
| Pig (BBM) | Multicam | 27 | โ Working |
- Sparse SfM pipeline
- Multicam support with calibrated poses
- Textureless surface handling
- Modular config system
- Dense fusion from seed points
- Multi-view stereo integration
- Mesh reconstruction
- Architecture Guide - Detailed module documentation
- Pipeline Details - Step-by-step algorithm explanation
- API Reference - Config classes and functions
- Getting Started - Installation and usage guide
- BBM Multi-camera dataset
- OpenCV SIFT implementation
- SciPy optimization for bundle adjustment