# dolphin-syndrom/visual_reconstruction architecture

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

- Interactive diagram: https://gitdiagram.com/dolphin-syndrom/visual_reconstruction
- Repository: https://github.com/dolphin-syndrom/visual_reconstruction

## Overview

This repository turns calibration and multi-view scene photographs into sparse and dense reconstructions, a surface mesh, metric-scale exports, and simulator-ready URDF assets. The primary workflow is sparse SfM → dense MVS → meshing, with validation and metric scaling/export as related branches. Most links are supported by README workflow statements or the shown callers; unsampled modules are represented only where documented, so their internal calls are not inferred.

Main entry points: [`geometry/scale_scene.py`](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/geometry/scale_scene.py) (Metric Scaling), [`visualization/diagnose_and_view.py`](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/visualization/diagnose_and_view.py) (Reconstruction Diagnostics), [`reconstruction/run_reconstruction.py`](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/reconstruction/run_reconstruction.py) (Sparse SfM), [`reconstruction/run_dense_reconstruction.py`](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/reconstruction/run_dense_reconstruction.py) (Dense MVS)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_calibration["Camera Calibration"]
  node_calibrate["Intrinsic Calibration"]
  node_grid["Grid Finder<br/>[find_grid.py]"]
end

subgraph group_reconstruction["3D Reconstruction"]
  node_sfm["Sparse SfM"]
  node_sparse_model[("Sparse Model")]
  node_dense["Dense MVS"]
  node_dense_cloud[("Fused Point Cloud")]
  node_surface["Poisson Meshing"]
  node_mesh[("Surface Mesh")]
end

subgraph group_geometry["Metric Geometry"]
  node_measurement["Ground Truth Measurement<br/>[measurement.txt]"]
  node_scale["Metric Scaling<br/>[scale_scene.py]"]
  node_scaled_model[("Scaled Reconstruction")]
  node_measure_object["Object Measurement<br/>[measure_object.py]"]
end

subgraph group_delivery["Validation and Viewing"]
  node_validate["Reprojection Validation"]
  node_export["Simulator Export<br/>[export_scene.py]"]
  node_diagnose["Reconstruction Diagnostics"]
  node_view_cloud["Sparse Cloud Viewer<br/>[view_cloud.py]"]
  node_view_dense["Dense Cloud Viewer<br/>[view_dense.py]"]
end

node_camera(("RGB Camera"))
node_scene_photos["Scene Photos"]
node_simulator(("Physics Simulators"))

node_camera -->|"provides images"| node_calibrate
node_scene_photos -->|"supplies photos"| node_sfm
node_sfm -->|"writes model"| node_sparse_model
node_sparse_model -->|"provides cameras"| node_dense
node_dense -->|"writes cloud"| node_dense_cloud
node_dense_cloud -->|"provides points"| node_surface
node_surface -->|"writes mesh"| node_mesh
node_measurement -->|"supplies dimension"| node_scale
node_sparse_model -->|"scales model"| node_scale
node_scale -->|"writes scaled model"| node_scaled_model
node_scaled_model -->|"checks reprojection"| node_validate
node_scaled_model -->|"exports geometry"| node_export
node_export -->|"loads URDF"| node_simulator
node_dense_cloud -.->|"measures object"| node_measure_object
node_sparse_model -->|"checks outputs"| node_diagnose
node_dense_cloud -->|"checks outputs"| node_diagnose
node_scaled_model -->|"checks export"| node_diagnose
node_scaled_model -->|"loads point cloud"| node_view_cloud
node_dense_cloud -->|"views cloud"| node_view_dense
node_grid -.->|"supports grid setup"| node_calibrate

click node_calibrate "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/calibration/calibrate_camera.py"
click node_grid "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/calibration/find_grid.py"
click node_scene_photos "https://github.com/dolphin-syndrom/visual_reconstruction/tree/main/data/scene"
click node_sfm "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/reconstruction/run_reconstruction.py"
click node_dense "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/reconstruction/run_dense_reconstruction.py"
click node_surface "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/reconstruction/run_surface_reconstruction.py"
click node_measurement "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/data/scene/measurement.txt"
click node_scale "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/geometry/scale_scene.py"
click node_measure_object "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/geometry/measure_object.py"
click node_validate "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/visualization/validate_reconstruction.py"
click node_export "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/visualization/export_scene.py"
click node_diagnose "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/visualization/diagnose_and_view.py"
click node_view_cloud "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/visualization/view_cloud.py"
click node_view_dense "https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/visualization/view_dense.py"

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_calibrate,node_grid toneBlue
class node_sfm,node_sparse_model,node_dense,node_dense_cloud,node_surface,node_mesh toneAmber
class node_measurement,node_scale,node_scaled_model,node_measure_object toneMint
class node_validate,node_export,node_diagnose,node_view_cloud,node_view_dense toneRose
class node_camera,node_simulator toneIndigo
class node_scene_photos toneTeal
```

## Components

### Camera Calibration

- [Intrinsic Calibration](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/calibration/calibrate_camera.py): `calibration/calibrate_camera.py`
- [Grid Finder](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/calibration/find_grid.py): `calibration/find_grid.py`

### 3D Reconstruction

- [Sparse SfM](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/reconstruction/run_reconstruction.py): `reconstruction/run_reconstruction.py`
- **Sparse Model**
- [Dense MVS](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/reconstruction/run_dense_reconstruction.py): `reconstruction/run_dense_reconstruction.py`
- **Fused Point Cloud**
- [Poisson Meshing](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/reconstruction/run_surface_reconstruction.py): `reconstruction/run_surface_reconstruction.py`
- **Surface Mesh**

### Metric Geometry

- [Ground Truth Measurement](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/data/scene/measurement.txt): `data/scene/measurement.txt`
- [Metric Scaling](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/geometry/scale_scene.py): `geometry/scale_scene.py`
- **Scaled Reconstruction**
- [Object Measurement](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/geometry/measure_object.py): `geometry/measure_object.py`

### Validation and Viewing

- [Reprojection Validation](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/visualization/validate_reconstruction.py): `visualization/validate_reconstruction.py`
- [Simulator Export](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/visualization/export_scene.py): `visualization/export_scene.py`
- [Reconstruction Diagnostics](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/visualization/diagnose_and_view.py): `visualization/diagnose_and_view.py`
- [Sparse Cloud Viewer](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/visualization/view_cloud.py): `visualization/view_cloud.py`
- [Dense Cloud Viewer](https://github.com/dolphin-syndrom/visual_reconstruction/blob/main/visualization/view_dense.py): `visualization/view_dense.py`

### Other components

- **RGB Camera**
- [Scene Photos](https://github.com/dolphin-syndrom/visual_reconstruction/tree/main/data/scene): `data/scene`
- **Physics Simulators**

## Connections

- RGB Camera → Intrinsic Calibration: provides images (evidence: `README.md`)
- Scene Photos → Sparse SfM: supplies photos (evidence: `README.md`)
- Sparse SfM → Sparse Model: writes model (evidence: `reconstruction/run_reconstruction.py`)
- Sparse Model → Dense MVS: provides cameras (evidence: `reconstruction/run_dense_reconstruction.py`)
- Dense MVS → Fused Point Cloud: writes cloud (evidence: `reconstruction/run_dense_reconstruction.py`)
- Fused Point Cloud → Poisson Meshing: provides points (evidence: `README.md`)
- Poisson Meshing → Surface Mesh: writes mesh (evidence: `reconstruction/run_surface_reconstruction.py`)
- Ground Truth Measurement → Metric Scaling: supplies dimension (evidence: `geometry/scale_scene.py`)
- Sparse Model → Metric Scaling: scales model (evidence: `geometry/scale_scene.py`)
- Metric Scaling → Scaled Reconstruction: writes scaled model (evidence: `geometry/scale_scene.py`)
- Scaled Reconstruction → Reprojection Validation: checks reprojection (evidence: `visualization/validate_reconstruction.py`)
- Scaled Reconstruction → Simulator Export: exports geometry (evidence: `visualization/export_scene.py`)
- Simulator Export → Physics Simulators: loads URDF (evidence: `README.md`)
- Fused Point Cloud → Object Measurement: measures object
- Sparse Model → Reconstruction Diagnostics: checks outputs (evidence: `visualization/diagnose_and_view.py`)
- Fused Point Cloud → Reconstruction Diagnostics: checks outputs (evidence: `visualization/diagnose_and_view.py`)
- Scaled Reconstruction → Reconstruction Diagnostics: checks export (evidence: `visualization/diagnose_and_view.py`)
- Scaled Reconstruction → Sparse Cloud Viewer: loads point cloud (evidence: `visualization/view_cloud.py`)
- Fused Point Cloud → Dense Cloud Viewer: views cloud (evidence: `README.md`)
- Grid Finder → Intrinsic Calibration: supports grid setup
