# gwetherholt/croptrackingsystem architecture

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

- Interactive diagram: https://gitdiagram.com/gwetherholt/croptrackingsystem
- Repository: https://github.com/gwetherholt/croptrackingsystem

## Overview

Crop Tracking is a command-line C++ application that turns frame detections in JSON into persistent object tracks, a tracking-results JSON file, and per-frame plus summary visualizations. The main workflow parses each frame, calls the tracker, and writes both outputs; tracking uses IoU and spatial-proximity matching, retaining IDs across brief detection gaps. A separate Python utility checks ID consistency in generated results. Relationships follow the sampled source and README; no unsampled implementation details are assumed.

Main entry points: [`src/main.cpp`](https://github.com/gwetherholt/croptrackingsystem/blob/main/src/main.cpp) (Frame processor), [`tools/check_ids.py`](https://github.com/gwetherholt/croptrackingsystem/blob/main/tools/check_ids.py) (ID consistency check), [`data/output/input_data/tracking_output.json`](https://github.com/gwetherholt/croptrackingsystem/blob/main/data/output/input_data/tracking_output.json) (Tracking JSON), [`data/input/input_data.json`](https://github.com/gwetherholt/croptrackingsystem/blob/main/data/input/input_data.json) (Detection JSON)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Command-line runtime"]
  node_main["Frame processor<br/>[main.cpp]"]
  node_input["Detection JSON<br/>[input_data.json]"]
end

subgraph group_tracking["Object tracking"]
  node_tracker["Track matching<br/>[tracker.cpp]"]
  node_visualizer["Image rendering<br/>[tracker.cpp]"]
end

subgraph group_outputs["Results and validation"]
  node_jsonout["Tracking JSON"]
  node_images["Frame and summary PNGs"]
  node_validator["ID consistency check<br/>[check_ids.py]"]
end

node_user(("CLI user"))

node_user -->|"runs"| node_main
node_main -->|"reads"| node_input
node_main -->|"updates tracks"| node_tracker
node_main -->|"renders frames"| node_visualizer
node_main -->|"writes results"| node_jsonout
node_main -->|"writes images"| node_images
node_user -->|"runs check"| node_validator
node_validator -->|"checks IDs"| node_jsonout

click node_main "https://github.com/gwetherholt/croptrackingsystem/blob/main/src/main.cpp"
click node_input "https://github.com/gwetherholt/croptrackingsystem/blob/main/data/input/input_data.json"
click node_tracker "https://github.com/gwetherholt/croptrackingsystem/blob/main/src/tracker.cpp"
click node_visualizer "https://github.com/gwetherholt/croptrackingsystem/blob/main/src/tracker.cpp"
click node_jsonout "https://github.com/gwetherholt/croptrackingsystem/blob/main/data/output/input_data/tracking_output.json"
click node_images "https://github.com/gwetherholt/croptrackingsystem/tree/main/data/output/input_data/visualization"
click node_validator "https://github.com/gwetherholt/croptrackingsystem/blob/main/tools/check_ids.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_main,node_input,node_user toneBlue
class node_tracker,node_visualizer toneAmber
class node_jsonout,node_images,node_validator toneMint
```

## Components

### Command-line runtime

- [Frame processor](https://github.com/gwetherholt/croptrackingsystem/blob/main/src/main.cpp): `src/main.cpp`
- [Detection JSON](https://github.com/gwetherholt/croptrackingsystem/blob/main/data/input/input_data.json): `data/input/input_data.json`

### Object tracking

- [Track matching](https://github.com/gwetherholt/croptrackingsystem/blob/main/src/tracker.cpp): `src/tracker.cpp`
- [Image rendering](https://github.com/gwetherholt/croptrackingsystem/blob/main/src/tracker.cpp): `src/tracker.cpp`

### Results and validation

- [Tracking JSON](https://github.com/gwetherholt/croptrackingsystem/blob/main/data/output/input_data/tracking_output.json): `data/output/input_data/tracking_output.json`
- [Frame and summary PNGs](https://github.com/gwetherholt/croptrackingsystem/tree/main/data/output/input_data/visualization): `data/output/input_data/visualization`
- [ID consistency check](https://github.com/gwetherholt/croptrackingsystem/blob/main/tools/check_ids.py): `tools/check_ids.py`

### Other components

- **CLI user**

## Connections

- CLI user → Frame processor: runs (evidence: `README.md`)
- Frame processor → Detection JSON: reads (evidence: `src/main.cpp`)
- Frame processor → Track matching: updates tracks (evidence: `src/main.cpp`)
- Frame processor → Image rendering: renders frames (evidence: `src/main.cpp`)
- Frame processor → Tracking JSON: writes results (evidence: `src/main.cpp`)
- Frame processor → Frame and summary PNGs: writes images (evidence: `src/main.cpp`)
- CLI user → ID consistency check: runs check (evidence: `README.md`)
- ID consistency check → Tracking JSON: checks IDs (evidence: `README.md`)
