# d4min/aircanvas architecture

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

- Interactive diagram: https://gitdiagram.com/d4min/aircanvas
- Repository: https://github.com/d4min/aircanvas

## Overview

##### Project Type & Purpose
- AirCanvas is a computer vision application that turns a webcam into a drawing canvas using hand gestures.
- Its key functions are capturing video frames, detecting hand landmarks to infer gestures, mapping gestures to drawing actions, and rendering a digital canvas.

##### Analyzing the File Structure
- The core project files are housed in the “src” directory:
- config.py: Likely handles configuration settings for the app (e.g., camera parameters, drawing configurations).
- hand_tracker.py: Implements real-time hand tracking using MediaPipe.
- gesture.py: Contains logic to interpret hand movements/gestures into drawing commands.
- drawing.py: Handles the actual drawing on a virtual canvas by interfacing with OpenCV.
- main.py: Serves as the entry point, orchestrating the interaction between modules.
- Other files such as requirements.txt and README.md help with environment setup and documentation.

##### Key Components to Highlight
a. Webcam/Capture Device: The starting point where video frames are captured.
b. Hand Tracking Module (hand_tracker.py):
- Uses MediaPipe to detect hand landmarks and track movement.
- Feeds landmark or coordinate data to the Gesture Module.
c. Gesture Recognition Module (gesture.py):
- Maps detected gestures to drawing instructions.
d. Drawing & Image Processing Module (drawing.py):
- Uses OpenCV to render the drawings

## Diagram (Mermaid)

```mermaid
graph TD
    %% Global Components
    W("Webcam/Capture Device"):::device
    config("Configuration Module"):::config
    tracker("Hand Tracking Module"):::tracker
    gesture("Gesture Recognition Module"):::gesture
    drawing("Drawing & Image Processing Module"):::drawing
    ui("User Interface Module"):::ui
    main("Main Application Orchestrator"):::main

    %% Orchestration and Flow
    main --> config
    main --> tracker
    main --> gesture
    main --> drawing
    main --> ui

    W --> tracker
    tracker --> gesture
    gesture --> drawing
    drawing --> ui

    %% Click Events
    click config "https://github.com/d4min/aircanvas/blob/main/src/config.py"
    click tracker "https://github.com/d4min/aircanvas/blob/main/src/hand_tracker.py"
    click gesture "https://github.com/d4min/aircanvas/blob/main/src/gesture.py"
    click drawing "https://github.com/d4min/aircanvas/blob/main/src/drawing.py"
    click ui "https://github.com/d4min/aircanvas/blob/main/src/ui.py"
    click main "https://github.com/d4min/aircanvas/blob/main/src/main.py"

    %% Styles and Colour Definitions
    classDef device fill:#ffcc00,stroke:#333,stroke-width:2px;
    classDef config fill:#ccffff,stroke:#333,stroke-width:2px;
    classDef tracker fill:#ccffcc,stroke:#333,stroke-width:2px;
    classDef gesture fill:#ffffcc,stroke:#333,stroke-width:2px;
    classDef drawing fill:#ffccff,stroke:#333,stroke-width:2px;
    classDef ui fill:#cce5ff,stroke:#333,stroke-width:2px;
    classDef main fill:#ffd699,stroke:#333,stroke-width:2px;
```
