# christophemura/top---tracking-of-people architecture

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

- Interactive diagram: https://gitdiagram.com/christophemura/top---tracking-of-people
- Repository: https://github.com/christophemura/top---tracking-of-people

## Overview

ToP is a C++ vision application for detecting people and tracking them across frames from an image, video, or camera. The principal workflow is to load an ONNX model, acquire frames, run detection and post-processing, pass video detections to ByteTrack for persistent IDs, and display results. The sampled source shows detection boxes being displayed; it does not show track IDs being rendered. ByteTrack’s tracking role is also documented in the README. The converter and image-processing helpers are separate capabilities; relationships are shown only where the excerpts or README support them.

Main entry points: [`Detection/code/src/main.cpp`](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp) (Application entry), [`Detection/code/include/mylib.h`](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/include/mylib.h) (Image helper API), [`Detection/code/src/mylib.cpp`](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/mylib.cpp) (Contour transform), [`Detection/code/models/PersonDetection.onnx`](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/models/PersonDetection.onnx) (Person ONNX model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Detection runtime"]
  node_app["Application entry<br/>[main.cpp]"]
  node_model_load["ONNX model load<br/>[main.cpp]"]
  node_frame_input["Frame acquisition<br/>[main.cpp]"]
  node_preprocess["Letterbox preprocessing<br/>[main.cpp]"]
  node_inference["YOLO inference<br/>[main.cpp]"]
  node_postprocess["Detection postprocess<br/>[main.cpp]"]
  node_display["Draw and display<br/>[main.cpp]"]
end

subgraph group_tracking["Tracking"]
  node_tracker["ByteTrack tracker"]
end

subgraph group_helpers["Image helpers"]
  node_contour["Contour transform<br/>[mylib.cpp]"]
  node_threshold["Color threshold<br/>[mylib.cpp]"]
  node_helper_api["Image helper API<br/>[mylib.h]"]
end

subgraph group_models["Model assets"]
  node_person_model["Person ONNX model"]
  node_home_model["Home object ONNX"]
end

node_user(("Operator"))
node_input(("Image / video / camera"))
node_viewer["OpenCV display"]

node_user -->|"runs"| node_app
node_input -->|"provides frames"| node_frame_input
node_app -->|"loads model"| node_model_load
node_person_model -->|"loaded as input"| node_model_load
node_app -->|"opens source"| node_frame_input
node_frame_input -->|"supplies frame"| node_preprocess
node_preprocess -->|"prepares input"| node_inference
node_model_load -->|"provides network"| node_inference
node_inference -->|"returns detections"| node_postprocess
node_app -->|"updates tracks"| node_tracker
node_postprocess -->|"passes detections"| node_tracker
node_app -->|"draws detections"| node_display
node_display -->|"shows frames"| node_viewer
node_app -->|"calls transform"| node_contour
node_app -->|"calls transform"| node_threshold
node_helper_api -->|"declares"| node_contour
node_helper_api -->|"declares"| node_threshold

click node_app "https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp"
click node_model_load "https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp"
click node_frame_input "https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp"
click node_preprocess "https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp"
click node_inference "https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp"
click node_postprocess "https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp"
click node_display "https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp"
click node_contour "https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/mylib.cpp"
click node_threshold "https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/mylib.cpp"
click node_helper_api "https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/include/mylib.h"
click node_person_model "https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/models/PersonDetection.onnx"
click node_home_model "https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/models/HomeObjectModel.onnx"

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_app,node_model_load,node_frame_input,node_preprocess,node_inference,node_postprocess,node_display toneBlue
class node_tracker toneAmber
class node_contour,node_threshold,node_helper_api toneMint
class node_person_model,node_home_model toneRose
class node_user,node_input,node_viewer toneIndigo
```

## Components

### Detection runtime

- [Application entry](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp): `Detection/code/src/main.cpp`
- [ONNX model load](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp): `Detection/code/src/main.cpp`
- [Frame acquisition](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp): `Detection/code/src/main.cpp`
- [Letterbox preprocessing](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp): `Detection/code/src/main.cpp`
- [YOLO inference](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp): `Detection/code/src/main.cpp`
- [Detection postprocess](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp): `Detection/code/src/main.cpp`
- [Draw and display](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/main.cpp): `Detection/code/src/main.cpp`

### Tracking

- **ByteTrack tracker**

### Image helpers

- [Contour transform](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/mylib.cpp): `Detection/code/src/mylib.cpp`
- [Color threshold](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/src/mylib.cpp): `Detection/code/src/mylib.cpp`
- [Image helper API](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/include/mylib.h): `Detection/code/include/mylib.h`

### Model assets

- [Person ONNX model](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/models/PersonDetection.onnx): `Detection/code/models/PersonDetection.onnx`
- [Home object ONNX](https://github.com/christophemura/top---tracking-of-people/blob/main/Detection/code/models/HomeObjectModel.onnx): `Detection/code/models/HomeObjectModel.onnx`

### Other components

- **Operator**
- **Image / video / camera**
- **OpenCV display**

## Connections

- Operator → Application entry: runs (evidence: `README.md`)
- Image / video / camera → Frame acquisition: provides frames (evidence: `README.md`)
- Application entry → ONNX model load: loads model (evidence: `Detection/code/src/main.cpp`)
- Person ONNX model → ONNX model load: loaded as input (evidence: `README.md`)
- Application entry → Frame acquisition: opens source (evidence: `Detection/code/src/main.cpp`)
- Frame acquisition → Letterbox preprocessing: supplies frame (evidence: `Detection/code/src/main.cpp`)
- Letterbox preprocessing → YOLO inference: prepares input (evidence: `Detection/code/src/main.cpp`)
- ONNX model load → YOLO inference: provides network (evidence: `Detection/code/src/main.cpp`)
- YOLO inference → Detection postprocess: returns detections (evidence: `Detection/code/src/main.cpp`)
- Application entry → ByteTrack tracker: updates tracks (evidence: `Detection/code/src/main.cpp`)
- Detection postprocess → ByteTrack tracker: passes detections (evidence: `README.md`)
- Application entry → Draw and display: draws detections (evidence: `Detection/code/src/main.cpp`)
- Draw and display → OpenCV display: shows frames (evidence: `Detection/code/src/main.cpp`)
- Application entry → Contour transform: calls transform (evidence: `Detection/code/src/main.cpp`)
- Application entry → Color threshold: calls transform (evidence: `Detection/code/src/main.cpp`)
- Image helper API → Contour transform: declares (evidence: `Detection/code/include/mylib.h`)
- Image helper API → Color threshold: declares (evidence: `Detection/code/include/mylib.h`)
