# fringehush-gif/colmap architecture

> Architecture diagram of the GitHub repository fringehush-gif/colmap, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fringehush-gif/colmap
- Repository: https://github.com/fringehush-gif/colmap

## Overview

COLMAP is a general-purpose image-based 3D reconstruction system with command-line, graphical, and Python interfaces. Its central workflow takes an image collection through feature extraction and matching into SfM reconstruction, then supports dense multi-view stereo and mesh generation. It also offers global, incremental, and hierarchical reconstruction, image retrieval, calibration, and model management. The graph combines documented product capabilities with relationships visible in the supplied source index and excerpts; unsampled subsystem wiring is left out where it cannot be verified.

Main entry points: [`src/colmap/controllers/automatic_reconstruction.cc`](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/automatic_reconstruction.cc) (Automatic reconstruction), [`src/colmap/controllers/global_pipeline.cc`](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/global_pipeline.cc) (Global SfM), [`src/colmap/sfm/observation_manager.cc`](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/sfm/observation_manager.cc) (Observation management), [`src/colmap/controllers/incremental_pipeline.cc`](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/incremental_pipeline.cc) (Incremental SfM)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interfaces["User Interfaces"]
  node_cli["Command line<br/>[colmap.cc]"]
  node_gui["Graphical interface<br/>[main_window.cc]"]
  node_python["Python bindings<br/>[main.cc]"]
end

subgraph group_sfm["SfM Reconstruction"]
  node_auto["Automatic reconstruction"]
  node_extract["Feature extraction"]
  node_match["Feature matching"]
  node_incremental["Incremental SfM"]
  node_global["Global SfM<br/>[global_pipeline.cc]"]
  node_hierarchical["Hierarchical SfM"]
  node_mapper["SfM mapping"]
  node_observations["Observation management"]
end

subgraph group_dense["Dense Reconstruction"]
  node_mvs["Multi-view stereo<br/>[patch_match.cc]"]
  node_depth["Depth and normals<br/>[depth_map.cc]"]
  node_mesh["Meshing and fusion<br/>[poisson_meshing.cc]"]
  node_poisson["Poisson reconstruction<br/>[Reconstructors.h]"]
end

subgraph group_core["Scene and Algorithms"]
  node_features["Feature algorithms<br/>[extractor.cc]"]
  node_retrieval["Image retrieval<br/>[vote_and_verify.cc]"]
  node_database[("Reconstruction database<br/>[database.h]")]
  node_reconstruction["3D reconstruction model<br/>[reconstruction.h]"]
  node_manager["Model management"]
  node_camera["Camera calibration<br/>[camera.h]"]
  node_rotation["Rotation averaging"]
  node_math["Math utilities<br/>[math.h]"]
  node_hash["Hash containers<br/>[hash_containers.h]"]
end

node_user(("Image collection"))

node_user -->|"provides images"| node_cli
node_user -->|"provides images"| node_gui
node_user -->|"provides images"| node_python
node_cli -.->|"starts reconstruction"| node_auto
node_gui -.->|"starts reconstruction"| node_auto
node_auto -.->|"runs workflow"| node_extract
node_auto -.->|"runs workflow"| node_match
node_extract -.->|"uses algorithms"| node_features
node_match -.->|"uses retrieval"| node_retrieval
node_auto -.->|"selects pipeline"| node_incremental
node_auto -.->|"selects pipeline"| node_global
node_auto -.->|"selects pipeline"| node_hierarchical
node_incremental -->|"reads database"| node_database
node_global -->|"loads cache"| node_database
node_global -->|"uses averaging"| node_rotation
node_incremental -.->|"runs mapper"| node_mapper
node_global -->|"runs mapper"| node_mapper
node_hierarchical -->|"reads database"| node_database
node_hierarchical -->|"uses manager"| node_observations
node_observations -->|"updates model"| node_reconstruction
node_observations -->|"checks projection"| node_camera
node_observations -->|"uses utilities"| node_math
node_observations -->|"uses containers"| node_hash
node_incremental -->|"manages models"| node_manager
node_global -->|"manages models"| node_manager
node_reconstruction -.->|"stores calibration"| node_camera
node_python -.->|"exposes pipeline"| node_incremental
node_mvs -.->|"estimates maps"| node_depth
node_depth -.->|"supports meshing"| node_mesh
node_mesh -.->|"uses mesher"| node_poisson

click node_cli "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/exe/colmap.cc"
click node_gui "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/ui/main_window.cc"
click node_python "https://github.com/fringehush-gif/colmap/blob/main/src/pycolmap/main.cc"
click node_auto "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/automatic_reconstruction.cc"
click node_extract "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/feature_extraction.cc"
click node_features "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/feature/extractor.cc"
click node_match "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/feature_matching.cc"
click node_retrieval "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/retrieval/vote_and_verify.cc"
click node_database "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/scene/database.h"
click node_incremental "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/incremental_pipeline.cc"
click node_global "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/global_pipeline.cc"
click node_hierarchical "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/hierarchical_pipeline.cc"
click node_mapper "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/sfm/incremental_mapper.cc"
click node_observations "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/sfm/observation_manager.cc"
click node_reconstruction "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/scene/reconstruction.h"
click node_manager "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/scene/reconstruction_manager.h"
click node_camera "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/scene/camera.h"
click node_rotation "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/estimators/rotation_averaging.h"
click node_math "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/math/math.h"
click node_hash "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/util/hash_containers.h"
click node_mvs "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/mvs/patch_match.cc"
click node_depth "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/mvs/depth_map.cc"
click node_mesh "https://github.com/fringehush-gif/colmap/blob/main/src/colmap/mvs/poisson_meshing.cc"
click node_poisson "https://github.com/fringehush-gif/colmap/blob/main/src/thirdparty/PoissonRecon/Reconstructors.h"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_gui,node_python toneBlue
class node_auto,node_extract,node_match,node_incremental,node_global,node_hierarchical,node_mapper,node_observations toneAmber
class node_mvs,node_depth,node_mesh,node_poisson toneMint
class node_features,node_retrieval,node_database,node_reconstruction,node_manager,node_camera,node_rotation,node_math,node_hash toneRose
class node_user toneIndigo
```

## Components

### User Interfaces

- [Command line](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/exe/colmap.cc): `src/colmap/exe/colmap.cc`
- [Graphical interface](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/ui/main_window.cc): `src/colmap/ui/main_window.cc`
- [Python bindings](https://github.com/fringehush-gif/colmap/blob/main/src/pycolmap/main.cc): `src/pycolmap/main.cc`

### SfM Reconstruction

- [Automatic reconstruction](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/automatic_reconstruction.cc): `src/colmap/controllers/automatic_reconstruction.cc`
- [Feature extraction](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/feature_extraction.cc): `src/colmap/controllers/feature_extraction.cc`
- [Feature matching](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/feature_matching.cc): `src/colmap/controllers/feature_matching.cc`
- [Incremental SfM](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/incremental_pipeline.cc): `src/colmap/controllers/incremental_pipeline.cc`
- [Global SfM](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/global_pipeline.cc): `src/colmap/controllers/global_pipeline.cc`
- [Hierarchical SfM](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/controllers/hierarchical_pipeline.cc): `src/colmap/controllers/hierarchical_pipeline.cc`
- [SfM mapping](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/sfm/incremental_mapper.cc): `src/colmap/sfm/incremental_mapper.cc`
- [Observation management](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/sfm/observation_manager.cc): `src/colmap/sfm/observation_manager.cc`

### Dense Reconstruction

- [Multi-view stereo](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/mvs/patch_match.cc): `src/colmap/mvs/patch_match.cc`
- [Depth and normals](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/mvs/depth_map.cc): `src/colmap/mvs/depth_map.cc`
- [Meshing and fusion](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/mvs/poisson_meshing.cc): `src/colmap/mvs/poisson_meshing.cc`
- [Poisson reconstruction](https://github.com/fringehush-gif/colmap/blob/main/src/thirdparty/PoissonRecon/Reconstructors.h): `src/thirdparty/PoissonRecon/Reconstructors.h`

### Scene and Algorithms

- [Feature algorithms](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/feature/extractor.cc): `src/colmap/feature/extractor.cc`
- [Image retrieval](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/retrieval/vote_and_verify.cc): `src/colmap/retrieval/vote_and_verify.cc`
- [Reconstruction database](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/scene/database.h): `src/colmap/scene/database.h`
- [3D reconstruction model](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/scene/reconstruction.h): `src/colmap/scene/reconstruction.h`
- [Model management](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/scene/reconstruction_manager.h): `src/colmap/scene/reconstruction_manager.h`
- [Camera calibration](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/scene/camera.h): `src/colmap/scene/camera.h`
- [Rotation averaging](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/estimators/rotation_averaging.h): `src/colmap/estimators/rotation_averaging.h`
- [Math utilities](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/math/math.h): `src/colmap/math/math.h`
- [Hash containers](https://github.com/fringehush-gif/colmap/blob/main/src/colmap/util/hash_containers.h): `src/colmap/util/hash_containers.h`

### Other components

- **Image collection**

## Connections

- Image collection → Command line: provides images
- Image collection → Graphical interface: provides images
- Image collection → Python bindings: provides images
- Command line → Automatic reconstruction: starts reconstruction
- Graphical interface → Automatic reconstruction: starts reconstruction
- Automatic reconstruction → Feature extraction: runs workflow
- Automatic reconstruction → Feature matching: runs workflow
- Feature extraction → Feature algorithms: uses algorithms
- Feature matching → Image retrieval: uses retrieval
- Automatic reconstruction → Incremental SfM: selects pipeline
- Automatic reconstruction → Global SfM: selects pipeline
- Automatic reconstruction → Hierarchical SfM: selects pipeline
- Incremental SfM → Reconstruction database: reads database (evidence: `src/colmap/controllers/incremental_pipeline.cc`)
- Global SfM → Reconstruction database: loads cache (evidence: `src/colmap/controllers/global_pipeline.cc`)
- Global SfM → Rotation averaging: uses averaging (evidence: `src/colmap/controllers/global_pipeline.cc`)
- Incremental SfM → SfM mapping: runs mapper
- Global SfM → SfM mapping: runs mapper (evidence: `src/colmap/controllers/global_pipeline.cc`)
- Hierarchical SfM → Reconstruction database: reads database (evidence: `src/colmap/controllers/hierarchical_pipeline.cc`)
- Hierarchical SfM → Observation management: uses manager (evidence: `src/colmap/controllers/hierarchical_pipeline.cc`)
- Observation management → 3D reconstruction model: updates model (evidence: `src/colmap/sfm/observation_manager.cc`)
- Observation management → Camera calibration: checks projection (evidence: `src/colmap/sfm/observation_manager.cc`)
- Observation management → Math utilities: uses utilities (evidence: `src/colmap/sfm/observation_manager.cc`)
- Observation management → Hash containers: uses containers (evidence: `src/colmap/sfm/observation_manager.cc`)
- Incremental SfM → Model management: manages models
- Global SfM → Model management: manages models (evidence: `src/colmap/controllers/global_pipeline.cc`)
- 3D reconstruction model → Camera calibration: stores calibration
- Python bindings → Incremental SfM: exposes pipeline
- Multi-view stereo → Depth and normals: estimates maps
- Depth and normals → Meshing and fusion: supports meshing
- Meshing and fusion → Poisson reconstruction: uses mesher
