# tristanenpc/bundleadjustementclassifier architecture

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

- Interactive diagram: https://gitdiagram.com/tristanenpc/bundleadjustementclassifier
- Repository: https://github.com/tristanenpc/bundleadjustementclassifier

## Overview

This repository implements satellite-image RPC bundle adjustment: users provide GeoTIFFs and RPC models, feature tracks connect images, and an optimization refines camera models and writes adjusted RPCs. The main stages are input loading, feature detection and matching, track construction and triangulation, adjustment/outlier handling, and RPC correction. The graph also shows geographic and camera-model support. Edges follow the README or the supplied excerpts and SOURCE INDEX references; unsampled implementation details and uncertain connections are omitted.

Main entry points: [`bundle_adjust/feature_tracks/ft_pipeline.py`](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_pipeline.py) (Track workflow), [`bundle_adjust/ba_pipeline.py`](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_pipeline.py) (Adjustment workflow), [`bundle_adjust/feature_tracks/ft_match.py`](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_match.py) (Pair matching), [`bundle_adjust/feature_tracks/ft_triangulate.py`](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_triangulate.py) (Track triangulation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs and geometry"]
  node_cli["Command-line entry<br/>[cli.py]"]
  node_scene["Scene workflow<br/>[ba_timeseries.py]"]
  node_loader["Image and RPC loading<br/>[loader.py]"]
  node_camera["Camera models<br/>[cam_utils.py]"]
  node_geo["Geographic utilities<br/>[geo_utils.py]"]
  node_geographiclib["Coordinate transforms<br/>[geographiclib.py]"]
end

subgraph group_tracks["Feature tracking"]
  node_ft_pipeline["Track workflow<br/>[ft_pipeline.py]"]
  node_ft_utils["Track construction<br/>[ft_utils.py]"]
  node_opencv["OpenCV features<br/>[ft_opencv.py]"]
  node_s2p_sift["S2P SIFT<br/>[sift.py]"]
  node_lightglue["LightGlue features<br/>[ft_lightglue.py]"]
  node_matcher["Pair matching<br/>[ft_match.py]"]
  node_ranking["Track ranking<br/>[ft_ranking.py]"]
  node_triangulation["Track triangulation<br/>[ft_triangulate.py]"]
end

subgraph group_adjustment["Bundle adjustment"]
  node_ba_pipeline["Adjustment workflow<br/>[ba_pipeline.py]"]
  node_params["Adjustment parameters<br/>[ba_params.py]"]
  node_solver["Optimization solver<br/>[ba_core.py]"]
  node_outliers["Outlier removal<br/>[ba_outliers.py]"]
end

subgraph group_rpc["RPC correction"]
  node_rpcfit["RPC fitting<br/>[ba_rpcfit.py]"]
  node_output["Adjusted RPC files<br/>[ba_pipeline.py]"]
  node_s2p_rpc["RPC utilities<br/>[rpc_utils.py]"]
end

node_user(("User"))

node_user -->|"runs config"| node_cli
node_cli -.->|"starts workflow"| node_scene
node_scene -->|"loads inputs"| node_loader
node_scene -->|"runs adjustment"| node_ba_pipeline
node_loader -->|"uses camera models"| node_camera
node_loader -->|"uses geometry"| node_geo
node_ft_pipeline -->|"detects features"| node_opencv
node_ft_pipeline -->|"matches pairs"| node_matcher
node_ft_pipeline -->|"builds tracks"| node_ft_utils
node_ft_pipeline -->|"uses detector"| node_lightglue
node_ft_pipeline -->|"uses detector"| node_s2p_sift
node_ft_pipeline -->|"triangulates tracks"| node_triangulation
node_matcher -->|"uses features"| node_opencv
node_matcher -->|"uses matcher"| node_lightglue
node_matcher -->|"uses matcher"| node_s2p_sift
node_ranking -->|"uses parameters"| node_params
node_triangulation -->|"uses image data"| node_loader
node_triangulation -->|"uses geometry"| node_geo
node_triangulation -->|"uses triangulation"| node_s2p_rpc
node_ba_pipeline -->|"defines parameters"| node_params
node_ba_pipeline -->|"runs optimization"| node_solver
node_ba_pipeline -->|"removes outliers"| node_outliers
node_ba_pipeline -->|"fits corrected RPCs"| node_rpcfit
node_ba_pipeline -->|"writes RPCs"| node_output
node_solver -->|"projects observations"| node_camera
node_params -->|"uses camera models"| node_camera
node_rpcfit -->|"uses RPC projection"| node_camera
node_s2p_rpc -->|"uses transforms"| node_geographiclib

click node_cli "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/cli.py"
click node_scene "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_timeseries.py"
click node_loader "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/loader.py"
click node_camera "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/cam_utils.py"
click node_geo "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/geo_utils.py"
click node_ft_pipeline "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_pipeline.py"
click node_ft_utils "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_utils.py"
click node_opencv "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_opencv.py"
click node_s2p_sift "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/s2p/sift.py"
click node_lightglue "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_lightglue.py"
click node_matcher "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_match.py"
click node_ranking "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_ranking.py"
click node_triangulation "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_triangulate.py"
click node_ba_pipeline "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_pipeline.py"
click node_params "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_params.py"
click node_solver "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_core.py"
click node_outliers "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_outliers.py"
click node_rpcfit "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_rpcfit.py"
click node_output "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_pipeline.py"
click node_s2p_rpc "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/s2p/rpc_utils.py"
click node_geographiclib "https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/s2p/geographiclib.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_cli,node_scene,node_loader,node_camera,node_geo,node_geographiclib,node_user toneBlue
class node_ft_pipeline,node_ft_utils,node_opencv,node_s2p_sift,node_lightglue,node_matcher,node_ranking,node_triangulation toneAmber
class node_ba_pipeline,node_params,node_solver,node_outliers toneMint
class node_rpcfit,node_output,node_s2p_rpc toneRose
```

## Components

### Inputs and geometry

- [Command-line entry](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/cli.py): `bundle_adjust/cli.py`
- [Scene workflow](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_timeseries.py): `bundle_adjust/ba_timeseries.py`
- [Image and RPC loading](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/loader.py): `bundle_adjust/loader.py`
- [Camera models](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/cam_utils.py): `bundle_adjust/cam_utils.py`
- [Geographic utilities](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/geo_utils.py): `bundle_adjust/geo_utils.py`
- [Coordinate transforms](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/s2p/geographiclib.py): `bundle_adjust/s2p/geographiclib.py`

### Feature tracking

- [Track workflow](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_pipeline.py): `bundle_adjust/feature_tracks/ft_pipeline.py`
- [Track construction](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_utils.py): `bundle_adjust/feature_tracks/ft_utils.py`
- [OpenCV features](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_opencv.py): `bundle_adjust/feature_tracks/ft_opencv.py`
- [S2P SIFT](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/s2p/sift.py): `bundle_adjust/s2p/sift.py`
- [LightGlue features](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_lightglue.py): `bundle_adjust/feature_tracks/ft_lightglue.py`
- [Pair matching](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_match.py): `bundle_adjust/feature_tracks/ft_match.py`
- [Track ranking](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_ranking.py): `bundle_adjust/feature_tracks/ft_ranking.py`
- [Track triangulation](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/feature_tracks/ft_triangulate.py): `bundle_adjust/feature_tracks/ft_triangulate.py`

### Bundle adjustment

- [Adjustment workflow](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_pipeline.py): `bundle_adjust/ba_pipeline.py`
- [Adjustment parameters](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_params.py): `bundle_adjust/ba_params.py`
- [Optimization solver](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_core.py): `bundle_adjust/ba_core.py`
- [Outlier removal](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_outliers.py): `bundle_adjust/ba_outliers.py`

### RPC correction

- [RPC fitting](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_rpcfit.py): `bundle_adjust/ba_rpcfit.py`
- [Adjusted RPC files](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/ba_pipeline.py): `bundle_adjust/ba_pipeline.py`
- [RPC utilities](https://github.com/tristanenpc/bundleadjustementclassifier/blob/master/bundle_adjust/s2p/rpc_utils.py): `bundle_adjust/s2p/rpc_utils.py`

### Other components

- **User**

## Connections

- User → Command-line entry: runs config
- Command-line entry → Scene workflow: starts workflow
- Scene workflow → Image and RPC loading: loads inputs (evidence: `bundle_adjust/ba_timeseries.py`)
- Scene workflow → Adjustment workflow: runs adjustment (evidence: `bundle_adjust/ba_timeseries.py`)
- Image and RPC loading → Camera models: uses camera models (evidence: `bundle_adjust/loader.py`)
- Image and RPC loading → Geographic utilities: uses geometry (evidence: `bundle_adjust/loader.py`)
- Track workflow → OpenCV features: detects features (evidence: `bundle_adjust/feature_tracks/ft_pipeline.py`)
- Track workflow → Pair matching: matches pairs (evidence: `bundle_adjust/feature_tracks/ft_pipeline.py`)
- Track workflow → Track construction: builds tracks (evidence: `bundle_adjust/feature_tracks/ft_pipeline.py`)
- Track workflow → LightGlue features: uses detector (evidence: `bundle_adjust/feature_tracks/ft_pipeline.py`)
- Track workflow → S2P SIFT: uses detector (evidence: `bundle_adjust/feature_tracks/ft_pipeline.py`)
- Track workflow → Track triangulation: triangulates tracks (evidence: `bundle_adjust/feature_tracks/ft_pipeline.py`)
- Pair matching → OpenCV features: uses features (evidence: `bundle_adjust/feature_tracks/ft_match.py`)
- Pair matching → LightGlue features: uses matcher (evidence: `bundle_adjust/feature_tracks/ft_match.py`)
- Pair matching → S2P SIFT: uses matcher (evidence: `bundle_adjust/feature_tracks/ft_match.py`)
- Track ranking → Adjustment parameters: uses parameters (evidence: `bundle_adjust/feature_tracks/ft_ranking.py`)
- Track triangulation → Image and RPC loading: uses image data (evidence: `bundle_adjust/feature_tracks/ft_triangulate.py`)
- Track triangulation → Geographic utilities: uses geometry (evidence: `bundle_adjust/feature_tracks/ft_triangulate.py`)
- Track triangulation → RPC utilities: uses triangulation (evidence: `bundle_adjust/feature_tracks/ft_triangulate.py`)
- Adjustment workflow → Adjustment parameters: defines parameters (evidence: `bundle_adjust/ba_pipeline.py`)
- Adjustment workflow → Optimization solver: runs optimization (evidence: `bundle_adjust/ba_pipeline.py`)
- Adjustment workflow → Outlier removal: removes outliers (evidence: `bundle_adjust/ba_pipeline.py`)
- Adjustment workflow → RPC fitting: fits corrected RPCs (evidence: `bundle_adjust/ba_pipeline.py`)
- Adjustment workflow → Adjusted RPC files: writes RPCs (evidence: `bundle_adjust/ba_pipeline.py`)
- Optimization solver → Camera models: projects observations (evidence: `bundle_adjust/ba_core.py`)
- Adjustment parameters → Camera models: uses camera models (evidence: `bundle_adjust/ba_params.py`)
- RPC fitting → Camera models: uses RPC projection (evidence: `bundle_adjust/ba_rpcfit.py`)
- RPC utilities → Coordinate transforms: uses transforms (evidence: `bundle_adjust/s2p/rpc_utils.py`)
