# sl1dee36/fire-grasp architecture

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

- Interactive diagram: https://gitdiagram.com/sl1dee36/fire-grasp
- Repository: https://github.com/sl1dee36/fire-grasp

## Overview

Fire-Grasp is a real-time desktop fire detector: it captures screen frames, processes them for fire-colored regions, optionally annotates movement, and displays the result. The main loop also supports interactive debug controls; a separate UI offers detector settings and rendering, while an image-correction tool derives fire-color ranges from marked pixels. The graph preserves these distinct workflows and the documented outline modes. Evidence is limited to the supplied excerpts and README; UI capture details are incomplete, so no capture-to-UI link is asserted.

Main entry points: [`main.py`](https://github.com/sl1dee36/fire-grasp/blob/main/main.py) (Detection loop), [`functions/detect_fire.py`](https://github.com/sl1dee36/fire-grasp/blob/main/functions/detect_fire.py) (Fire segmentation), [`tools/ui.py`](https://github.com/sl1dee36/fire-grasp/blob/main/tools/ui.py) (Settings UI), [`tools/FireDetectionCorrector.py`](https://github.com/sl1dee36/fire-grasp/blob/main/tools/FireDetectionCorrector.py) (Image corrector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Detection Runtime"]
  node_desktop["Screen capture<br/>[main.py]"]
  node_loop["Detection loop<br/>[main.py]"]
  node_detect["Fire segmentation<br/>[detect_fire.py]"]
  node_outline["Fire outlines<br/>[detect_fire.py]"]
  node_hex["Hexagon drawing<br/>[draw_hexagon.py]"]
  node_motion["Direction overlay"]
end

subgraph group_controls["Controls and Display"]
  node_debug["Debug trackbars<br/>[debug_menu.py]"]
  node_display["OpenCV display<br/>[main.py]"]
  node_ui["Settings UI<br/>[ui.py]"]
end

subgraph group_calibration["Fire Calibration"]
  node_corrector["Image corrector"]
  node_rangefile["Fire ranges<br/>[FireDatas.txt]"]
end

node_operator(("Desktop user"))

node_operator -->|"starts detection"| node_loop
node_loop -->|"captures frames"| node_desktop
node_loop -->|"processes frames"| node_detect
node_detect -->|"draws contours"| node_outline
node_detect -->|"draws hexagons"| node_hex
node_loop -->|"adds direction"| node_motion
node_loop -->|"opens controls"| node_debug
node_loop -->|"shows frame"| node_display
node_operator -->|"adjusts settings"| node_ui
node_ui -->|"processes frames"| node_detect
node_ui -->|"adds direction"| node_motion
node_operator -->|"marks fire pixels"| node_corrector
node_corrector -->|"saves ranges"| node_rangefile

click node_desktop "https://github.com/sl1dee36/fire-grasp/blob/main/main.py"
click node_loop "https://github.com/sl1dee36/fire-grasp/blob/main/main.py"
click node_detect "https://github.com/sl1dee36/fire-grasp/blob/main/functions/detect_fire.py"
click node_outline "https://github.com/sl1dee36/fire-grasp/blob/main/functions/detect_fire.py"
click node_hex "https://github.com/sl1dee36/fire-grasp/blob/main/functions/draw_hexagon.py"
click node_motion "https://github.com/sl1dee36/fire-grasp/blob/main/functions/detect_fire_direction.py"
click node_debug "https://github.com/sl1dee36/fire-grasp/blob/main/functions/debug_menu.py"
click node_display "https://github.com/sl1dee36/fire-grasp/blob/main/main.py"
click node_ui "https://github.com/sl1dee36/fire-grasp/blob/main/tools/ui.py"
click node_corrector "https://github.com/sl1dee36/fire-grasp/blob/main/tools/FireDetectionCorrector.py"
click node_rangefile "https://github.com/sl1dee36/fire-grasp/blob/main/tools/FireDatas.txt"

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_desktop,node_loop,node_detect,node_outline,node_hex,node_motion,node_operator toneBlue
class node_debug,node_display,node_ui toneAmber
class node_corrector,node_rangefile toneMint
```

## Components

### Detection Runtime

- [Screen capture](https://github.com/sl1dee36/fire-grasp/blob/main/main.py): `main.py`
- [Detection loop](https://github.com/sl1dee36/fire-grasp/blob/main/main.py): `main.py`
- [Fire segmentation](https://github.com/sl1dee36/fire-grasp/blob/main/functions/detect_fire.py): `functions/detect_fire.py`
- [Fire outlines](https://github.com/sl1dee36/fire-grasp/blob/main/functions/detect_fire.py): `functions/detect_fire.py`
- [Hexagon drawing](https://github.com/sl1dee36/fire-grasp/blob/main/functions/draw_hexagon.py): `functions/draw_hexagon.py`
- [Direction overlay](https://github.com/sl1dee36/fire-grasp/blob/main/functions/detect_fire_direction.py): `functions/detect_fire_direction.py`

### Controls and Display

- [Debug trackbars](https://github.com/sl1dee36/fire-grasp/blob/main/functions/debug_menu.py): `functions/debug_menu.py`
- [OpenCV display](https://github.com/sl1dee36/fire-grasp/blob/main/main.py): `main.py`
- [Settings UI](https://github.com/sl1dee36/fire-grasp/blob/main/tools/ui.py): `tools/ui.py`

### Fire Calibration

- [Image corrector](https://github.com/sl1dee36/fire-grasp/blob/main/tools/FireDetectionCorrector.py): `tools/FireDetectionCorrector.py`
- [Fire ranges](https://github.com/sl1dee36/fire-grasp/blob/main/tools/FireDatas.txt): `tools/FireDatas.txt`

### Other components

- **Desktop user**

## Connections

- Desktop user → Detection loop: starts detection (evidence: `README.md`)
- Detection loop → Screen capture: captures frames (evidence: `main.py`)
- Detection loop → Fire segmentation: processes frames (evidence: `main.py`)
- Fire segmentation → Fire outlines: draws contours (evidence: `functions/detect_fire.py`)
- Fire segmentation → Hexagon drawing: draws hexagons (evidence: `functions/detect_fire.py`)
- Detection loop → Direction overlay: adds direction (evidence: `main.py`)
- Detection loop → Debug trackbars: opens controls (evidence: `main.py`)
- Detection loop → OpenCV display: shows frame (evidence: `main.py`)
- Desktop user → Settings UI: adjusts settings (evidence: `tools/ui.py`)
- Settings UI → Fire segmentation: processes frames (evidence: `tools/ui.py`)
- Settings UI → Direction overlay: adds direction (evidence: `tools/ui.py`)
- Desktop user → Image corrector: marks fire pixels (evidence: `tools/FireDetectionCorrector.py`)
- Image corrector → Fire ranges: saves ranges (evidence: `tools/FireDetectionCorrector.py`)
