# boggiomichael/syrup architecture

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

- Interactive diagram: https://gitdiagram.com/boggiomichael/syrup
- Repository: https://github.com/boggiomichael/syrup

## Overview

Syrup is a Rust library for turning image frames into visual observations, not a domain-specific application. A consumer supplies frames (or captures a Windows window), then calls the relevant geometry, motion, OCR, or quality APIs; results and detector metadata are interpreted by that consumer. The README documents these capabilities, while excerpts show motion tracking and shared result types. Some integration details are unsampled, so the graph omits uncertain links rather than assuming a single pipeline.

Main entry points: [`src/motion.rs`](https://github.com/boggiomichael/syrup/blob/main/src/motion.rs) (Motion detection), [`src/geometry.rs`](https://github.com/boggiomichael/syrup/blob/main/src/geometry.rs) (Geometry analysis), [`src/ocr/mod.rs`](https://github.com/boggiomichael/syrup/blob/main/src/ocr/mod.rs) (OCR orchestration), [`src/capture.rs`](https://github.com/boggiomichael/syrup/blob/main/src/capture.rs) (Window capture)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_input["Frame input"]
  node_frames["RGBA frames"]
  node_capture["Window capture<br/>[capture.rs]"]
end

subgraph group_vision["Visual primitives"]
  node_geometry["Geometry analysis<br/>[geometry.rs]"]
  node_color["Color predicates<br/>[color.rs]"]
  node_motion["Motion detection<br/>[motion.rs]"]
  node_tracking["Centroid tracking<br/>[tracking.rs]"]
end

subgraph group_text["Text recognition"]
  node_quality["Text quality<br/>[quality.rs]"]
  node_ocr["OCR orchestration<br/>[mod.rs]"]
  node_windows_ocr["Windows OCR<br/>[windows.rs]"]
  node_tesseract["Tesseract"]
end

subgraph group_support["Shared support"]
  node_detection["Detection results<br/>[detection.rs]"]
  node_draw["Debug drawing<br/>[draw.rs]"]
  node_timing["Timing metrics<br/>[timing.rs]"]
end

node_consumer(("Library consumer"))

node_consumer -->|"requests capture"| node_capture
node_capture -->|"returns frames"| node_frames
node_consumer -->|"supplies frames"| node_frames
node_consumer -->|"locates regions"| node_geometry
node_consumer -->|"tests pixels"| node_color
node_consumer -->|"detects movement"| node_motion
node_consumer -->|"assesses sharpness"| node_quality
node_consumer -->|"recognizes text"| node_ocr
node_consumer -->|"annotates frames"| node_draw
node_consumer -->|"measures timing"| node_timing
node_geometry -->|"uses predicates"| node_color
node_motion -->|"extracts regions"| node_geometry
node_motion -->|"updates tracks"| node_tracking
node_motion -->|"builds results"| node_detection
node_tracking -->|"uses confidence"| node_detection
node_quality -->|"uses rectangles"| node_geometry
node_ocr -->|"offers backend"| node_windows_ocr
node_ocr -->|"runs OCR"| node_tesseract

click node_capture "https://github.com/boggiomichael/syrup/blob/main/src/capture.rs"
click node_geometry "https://github.com/boggiomichael/syrup/blob/main/src/geometry.rs"
click node_color "https://github.com/boggiomichael/syrup/blob/main/src/color.rs"
click node_motion "https://github.com/boggiomichael/syrup/blob/main/src/motion.rs"
click node_tracking "https://github.com/boggiomichael/syrup/blob/main/src/tracking.rs"
click node_quality "https://github.com/boggiomichael/syrup/blob/main/src/quality.rs"
click node_ocr "https://github.com/boggiomichael/syrup/blob/main/src/ocr/mod.rs"
click node_windows_ocr "https://github.com/boggiomichael/syrup/blob/main/src/ocr/windows.rs"
click node_detection "https://github.com/boggiomichael/syrup/blob/main/src/detection.rs"
click node_draw "https://github.com/boggiomichael/syrup/blob/main/src/draw.rs"
click node_timing "https://github.com/boggiomichael/syrup/blob/main/src/timing.rs"

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_frames,node_capture toneBlue
class node_geometry,node_color,node_motion,node_tracking toneAmber
class node_quality,node_ocr,node_windows_ocr,node_tesseract toneMint
class node_detection,node_draw,node_timing toneRose
class node_consumer toneIndigo
```

## Components

### Frame input

- **RGBA frames**
- [Window capture](https://github.com/boggiomichael/syrup/blob/main/src/capture.rs): `src/capture.rs`

### Visual primitives

- [Geometry analysis](https://github.com/boggiomichael/syrup/blob/main/src/geometry.rs): `src/geometry.rs`
- [Color predicates](https://github.com/boggiomichael/syrup/blob/main/src/color.rs): `src/color.rs`
- [Motion detection](https://github.com/boggiomichael/syrup/blob/main/src/motion.rs): `src/motion.rs`
- [Centroid tracking](https://github.com/boggiomichael/syrup/blob/main/src/tracking.rs): `src/tracking.rs`

### Text recognition

- [Text quality](https://github.com/boggiomichael/syrup/blob/main/src/quality.rs): `src/quality.rs`
- [OCR orchestration](https://github.com/boggiomichael/syrup/blob/main/src/ocr/mod.rs): `src/ocr/mod.rs`
- [Windows OCR](https://github.com/boggiomichael/syrup/blob/main/src/ocr/windows.rs): `src/ocr/windows.rs`
- **Tesseract**

### Shared support

- [Detection results](https://github.com/boggiomichael/syrup/blob/main/src/detection.rs): `src/detection.rs`
- [Debug drawing](https://github.com/boggiomichael/syrup/blob/main/src/draw.rs): `src/draw.rs`
- [Timing metrics](https://github.com/boggiomichael/syrup/blob/main/src/timing.rs): `src/timing.rs`

### Other components

- **Library consumer**

## Connections

- Library consumer → Window capture: requests capture (evidence: `README.md`)
- Window capture → RGBA frames: returns frames (evidence: `README.md`)
- Library consumer → RGBA frames: supplies frames (evidence: `README.md`)
- Library consumer → Geometry analysis: locates regions (evidence: `README.md`)
- Library consumer → Color predicates: tests pixels (evidence: `README.md`)
- Library consumer → Motion detection: detects movement (evidence: `README.md`)
- Library consumer → Text quality: assesses sharpness (evidence: `README.md`)
- Library consumer → OCR orchestration: recognizes text (evidence: `README.md`)
- Library consumer → Debug drawing: annotates frames (evidence: `README.md`)
- Library consumer → Timing metrics: measures timing (evidence: `README.md`)
- Geometry analysis → Color predicates: uses predicates (evidence: `src/geometry.rs`)
- Motion detection → Geometry analysis: extracts regions (evidence: `src/motion.rs`)
- Motion detection → Centroid tracking: updates tracks (evidence: `src/motion.rs`)
- Motion detection → Detection results: builds results (evidence: `src/motion.rs`)
- Centroid tracking → Detection results: uses confidence (evidence: `src/tracking.rs`)
- Text quality → Geometry analysis: uses rectangles (evidence: `src/quality.rs`)
- OCR orchestration → Windows OCR: offers backend (evidence: `src/ocr/mod.rs`)
- OCR orchestration → Tesseract: runs OCR (evidence: `README.md`)
