# viral-doshi/gesture-controlled-virtual-mouse architecture

> Architecture diagram of the GitHub repository viral-doshi/gesture-controlled-virtual-mouse, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/viral-doshi/gesture-controlled-virtual-mouse
- Repository: https://github.com/viral-doshi/gesture-controlled-virtual-mouse

## Overview

##### Main Components
- Gesture Recognition Module – This includes files like Gesture_Controller.py and Gesture_Controller_Gloved.py that implement hand tracking and gesture-based cursor control. There is a specific branch for “gloved” operation versus naked-hand detection using MediaPipe.
- Voice Assistant Module – Represented by Proton.py, this module manages voice commands to perform tasks from launching/stopping gesture recognition to performing actions like Google search, file navigation, and controlling device volume/brightness.
- Web Interface Component – The src/web folder contains HTML, CSS, and JavaScript files. This suggests that the project includes a simple front-end, potentially for visual feedback or status display.
- Supporting resources – Calibration images and configuration files found in src/calib_images and the demo_media (videos and gifs) which illustrate the gestures and outcomes.
- External Libraries/Frameworks – The README and project metadata indicate a dependency on Python 3.8.5, MediaPipe, pybind11 (for the underlying models), PyAudio, and pywin32. These should be highlighted as they are critical to the system’s operation.

##### Relationships and Interactions
- The Gesture Recognition module captures frames from the webcam and processes them using computer vision algorithms to detect hand gestures. These gestures are then mapped to mouse actions (cursor movement, clicking, scrolling, etc.).
- The Voice Assistant module operates alongside the gesture controller. It listens for voice commands (using PyAudio and related libraries) and triggers corresponding actions in the system. It may also control the start and stop of the gesture recognition thread.
- In certain cases, the two modules may interact; for example, a voice command (“Proton Launch Gesture Recognition”) causes the gesture recognition to initiate.
- The web component (found under src/web) may provide a UI layer to display status, instructions, or visual feedback of the gesture recognition process, effectively serving as an additional presentation layer.

##### Architectural Patterns and Principles
- Modular Design – The system is clearly divided between gesture recognition and voice control as separate modules. Each module has its dedicated entry scripts and resources.
- Separation of Concerns – Gesture functionality and voice command functionality are decoupled from each other, which enables isolated development and testing.

## Diagram (Mermaid)

```mermaid
graph TD
    %% User Inputs
    subgraph "User Inputs"
        Webcam("Webcam"):::input
        Mic("Microphone"):::input
    end

    %% Processing Modules
    subgraph "Processing Modules"
        subgraph "Gesture Recognition Module"
            GR1("Gesture_Controller.py"):::processing
            GR2("Gesture_Controller_Gloved.py"):::processing
        end
        subgraph "Voice Assistant Module"
            VA("Proton.py"):::processing
        end
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        WEB("Web Interface"):::ui
    end

    %% System Resources
    subgraph "System Resources"
        RES1("Calibration Images"):::resources
        RES2("Demo Media"):::resources
        DEP("Dependencies"):::resources
    end

    %% Operating System Actions
    OS("OS (System Actions)"):::output

    %% Connections from User Inputs to Processing Modules
    Webcam -->|"frames"| GR1
    Mic -->|"voiceInput"| VA

    %% Inter-module interaction
    VA -->|"launchGestureRec"| GR1

    %% Processing Modules output to OS
    GR1 -->|"simulateIO"| OS
    GR2 -->|"simulateIO"| OS
    VA -->|"controlDevice"| OS

    %% Feedback to Presentation Layer
    GR1 -->|"statusUpdate"| WEB
    VA -->|"statusUpdate"| WEB

    %% Dependencies and Resources usage
    GR1 -->|"calibration"| RES1
    GR1 -->|"demoMedia"| RES2
    GR1 -->|"requires"| DEP
    VA -->|"requires"| DEP

    %% Classes
    classDef input fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef processing fill:#87CEEB,stroke:#333,stroke-width:2px;
    classDef ui fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef resources fill:#D3D3D3,stroke:#333,stroke-width:2px;
    classDef output fill:#FFB6C1,stroke:#333,stroke-width:2px;

    %% Click Events
    click GR1 "https://github.com/viral-doshi/gesture-controlled-virtual-mouse/blob/main/src/Gesture_Controller.py"
    click GR2 "https://github.com/viral-doshi/gesture-controlled-virtual-mouse/blob/main/src/Gesture_Controller_Gloved.py"
    click VA "https://github.com/viral-doshi/gesture-controlled-virtual-mouse/blob/main/src/Proton.py"
    click WEB "https://github.com/viral-doshi/gesture-controlled-virtual-mouse/tree/main/src/web"
    click RES1 "https://github.com/viral-doshi/gesture-controlled-virtual-mouse/tree/main/src/calib_images"
    click RES2 "https://github.com/viral-doshi/gesture-controlled-virtual-mouse/tree/main/demo_media"
    click DEP "https://github.com/viral-doshi/gesture-controlled-virtual-mouse/blob/main/requirements.txt"
```
