# zannbjir/kicau-mania architecture

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

- Interactive diagram: https://gitdiagram.com/zannbjir/kicau-mania
- Repository: https://github.com/zannbjir/kicau-mania

## Overview

This small Python application captures webcam frames, detects hand landmarks with MediaPipe, classifies a “Mikir” pose, and smooths detection across three frames. When the pose is stable, it plays the bundled cat video in a window; otherwise it closes that window and resets video playback. The README documents this user workflow. The sampled source is all in main.py, so the stages below are logical responsibilities within that file, not separate modules.

Main entry points: [`main.py`](https://github.com/zannbjir/kicau-mania/blob/main/main.py) (Main loop), [`hand_landmarker.task`](https://github.com/zannbjir/kicau-mania/blob/main/hand_landmarker.task) (Landmarker model), [`kicau.mp4`](https://github.com/zannbjir/kicau-mania/blob/main/kicau.mp4) (Cat video)

## Diagram (Mermaid)

```mermaid
flowchart TD

node_user(("User"))
node_runtime["Main loop<br/>[main.py]"]
node_camera["Webcam"]
node_model["Landmarker model"]
node_detector["Hand detector<br/>[main.py]"]
node_classifier["Pose classifier<br/>[main.py]"]
node_smoother["Gesture smoother<br/>[main.py]"]
node_video["Cat video<br/>[kicau.mp4]"]
node_playback["Video playback<br/>[main.py]"]
node_windows["OpenCV windows"]

node_user -->|"starts"| node_runtime
node_user -->|"presses key"| node_runtime
node_runtime -->|"reads frames"| node_camera
node_runtime -->|"loads"| node_model
node_runtime -->|"configures"| node_detector
node_runtime -->|"detects"| node_detector
node_detector -->|"landmarks"| node_classifier
node_runtime -->|"classifies pose"| node_classifier
node_classifier -->|"gesture"| node_smoother
node_runtime -->|"updates history"| node_smoother
node_smoother -->|"dispatches"| node_playback
node_runtime -->|"reads"| node_video
node_runtime -->|"reads frames"| node_playback
node_runtime -->|"shows or closes"| node_windows

click node_runtime "https://github.com/zannbjir/kicau-mania/blob/main/main.py"
click node_model "https://github.com/zannbjir/kicau-mania/blob/main/hand_landmarker.task"
click node_detector "https://github.com/zannbjir/kicau-mania/blob/main/main.py"
click node_classifier "https://github.com/zannbjir/kicau-mania/blob/main/main.py"
click node_smoother "https://github.com/zannbjir/kicau-mania/blob/main/main.py"
click node_video "https://github.com/zannbjir/kicau-mania/blob/main/kicau.mp4"
click node_playback "https://github.com/zannbjir/kicau-mania/blob/main/main.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_user toneBlue
class node_runtime,node_detector,node_classifier,node_smoother,node_video,node_playback toneTeal
class node_camera,node_model,node_windows toneIndigo
```

## Components

### Other components

- **User**
- [Main loop](https://github.com/zannbjir/kicau-mania/blob/main/main.py): `main.py`
- **Webcam**
- [Landmarker model](https://github.com/zannbjir/kicau-mania/blob/main/hand_landmarker.task): `hand_landmarker.task`
- [Hand detector](https://github.com/zannbjir/kicau-mania/blob/main/main.py): `main.py`
- [Pose classifier](https://github.com/zannbjir/kicau-mania/blob/main/main.py): `main.py`
- [Gesture smoother](https://github.com/zannbjir/kicau-mania/blob/main/main.py): `main.py`
- [Cat video](https://github.com/zannbjir/kicau-mania/blob/main/kicau.mp4): `kicau.mp4`
- [Video playback](https://github.com/zannbjir/kicau-mania/blob/main/main.py): `main.py`
- **OpenCV windows**

## Connections

- User → Main loop: starts
- User → Main loop: presses key
- Main loop → Webcam: reads frames
- Main loop → Landmarker model: loads
- Main loop → Hand detector: configures
- Main loop → Hand detector: detects
- Hand detector → Pose classifier: landmarks
- Main loop → Pose classifier: classifies pose
- Pose classifier → Gesture smoother: gesture
- Main loop → Gesture smoother: updates history
- Gesture smoother → Video playback: dispatches
- Main loop → Cat video: reads
- Main loop → Video playback: reads frames
- Main loop → OpenCV windows: shows or closes
