# talha50819/gesture-controlled architecture

> Architecture diagram of the GitHub repository talha50819/gesture-controlled, 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/talha50819/gesture-controlled
- Repository: https://github.com/talha50819/gesture-controlled

## Overview

This small project offers two standalone webcam-control workflows. The README’s primary workflow detects thumb and index-finger landmarks, maps their distance to system volume, and displays a volume indicator. A second script instead interprets the fingers’ vertical ordering and sends volume-key presses. Both scripts capture and display video; the source shows no shared runtime module. The graph represents stages within each script, not separate code modules.

Main entry points: [`inst2.py`](https://github.com/talha50819/gesture-controlled/blob/main/inst2.py) (Distance Script), [`OpenCV Volume Control.py`](https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.py) (Gesture Script)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_distance["Distance Control"]
  node_inst_entry["Distance Script<br/>[inst2.py]"]
  node_distance_map["Distance Mapping<br/>[inst2.py]"]
  node_pycaw["Audio Endpoint<br/>[inst2.py]"]
end

subgraph group_gesture["Gesture Control"]
  node_gesture_entry["Gesture Script"]
  node_vertical_gesture["Vertical Gesture"]
  node_key_dispatch["Volume Key Dispatch"]
end

subgraph group_vision["Camera and Display"]
  node_frame_capture["Frame Capture<br/>[inst2.py]"]
  node_hand_landmarks["Hand Landmarks<br/>[inst2.py]"]
  node_distance_overlay["Volume Overlay<br/>[inst2.py]"]
  node_distance_display["Video Display<br/>[inst2.py]"]
  node_gesture_capture["Frame Capture"]
  node_gesture_landmarks["Hand Landmarks"]
  node_gesture_display["Video Display"]
end

node_user(("User"))
node_camera(("Webcam"))
node_audio(("System Audio"))
node_volume_keys(("Volume Keys"))

node_user -->|"runs"| node_inst_entry
node_user -->|"runs"| node_gesture_entry
node_camera -->|"provides frames"| node_frame_capture
node_inst_entry -->|"reads frames"| node_frame_capture
node_frame_capture -->|"processes frames"| node_hand_landmarks
node_inst_entry -->|"maps landmark distance"| node_distance_map
node_hand_landmarks -->|"supplies coordinates"| node_distance_map
node_inst_entry -->|"sets volume"| node_pycaw
node_distance_map -->|"provides level"| node_pycaw
node_pycaw -->|"sets endpoint level"| node_audio
node_inst_entry -->|"draws indicator"| node_distance_overlay
node_distance_map -->|"provides percentage"| node_distance_overlay
node_inst_entry -->|"shows frame"| node_distance_display
node_distance_overlay -->|"draws on frame"| node_distance_display
node_camera -->|"provides frames"| node_gesture_capture
node_gesture_entry -->|"reads frames"| node_gesture_capture
node_gesture_capture -->|"processes frames"| node_gesture_landmarks
node_gesture_entry -->|"classifies finger ordering"| node_vertical_gesture
node_gesture_landmarks -->|"supplies positions"| node_vertical_gesture
node_gesture_entry -->|"dispatches keys"| node_key_dispatch
node_vertical_gesture -->|"selects volume key"| node_key_dispatch
node_key_dispatch -->|"presses keys"| node_volume_keys
node_gesture_entry -->|"shows frame"| node_gesture_display
node_gesture_landmarks -->|"draws landmarks"| node_gesture_display

click node_inst_entry "https://github.com/talha50819/gesture-controlled/blob/main/inst2.py"
click node_frame_capture "https://github.com/talha50819/gesture-controlled/blob/main/inst2.py"
click node_hand_landmarks "https://github.com/talha50819/gesture-controlled/blob/main/inst2.py"
click node_distance_map "https://github.com/talha50819/gesture-controlled/blob/main/inst2.py"
click node_pycaw "https://github.com/talha50819/gesture-controlled/blob/main/inst2.py"
click node_distance_overlay "https://github.com/talha50819/gesture-controlled/blob/main/inst2.py"
click node_distance_display "https://github.com/talha50819/gesture-controlled/blob/main/inst2.py"
click node_gesture_entry "https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.py"
click node_gesture_capture "https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.py"
click node_gesture_landmarks "https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.py"
click node_vertical_gesture "https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.py"
click node_key_dispatch "https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.py"
click node_gesture_display "https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.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_inst_entry,node_distance_map,node_pycaw,node_user toneBlue
class node_gesture_entry,node_vertical_gesture,node_key_dispatch toneAmber
class node_frame_capture,node_hand_landmarks,node_distance_overlay,node_distance_display,node_gesture_capture,node_gesture_landmarks,node_gesture_display toneMint
class node_camera,node_audio,node_volume_keys toneIndigo
```

## Components

### Distance Control

- [Distance Script](https://github.com/talha50819/gesture-controlled/blob/main/inst2.py): `inst2.py`
- [Distance Mapping](https://github.com/talha50819/gesture-controlled/blob/main/inst2.py): `inst2.py`
- [Audio Endpoint](https://github.com/talha50819/gesture-controlled/blob/main/inst2.py): `inst2.py`

### Gesture Control

- [Gesture Script](https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.py): `OpenCV Volume Control.py`
- [Vertical Gesture](https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.py): `OpenCV Volume Control.py`
- [Volume Key Dispatch](https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.py): `OpenCV Volume Control.py`

### Camera and Display

- [Frame Capture](https://github.com/talha50819/gesture-controlled/blob/main/inst2.py): `inst2.py`
- [Hand Landmarks](https://github.com/talha50819/gesture-controlled/blob/main/inst2.py): `inst2.py`
- [Volume Overlay](https://github.com/talha50819/gesture-controlled/blob/main/inst2.py): `inst2.py`
- [Video Display](https://github.com/talha50819/gesture-controlled/blob/main/inst2.py): `inst2.py`
- [Frame Capture](https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.py): `OpenCV Volume Control.py`
- [Hand Landmarks](https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.py): `OpenCV Volume Control.py`
- [Video Display](https://github.com/talha50819/gesture-controlled/blob/main/OpenCV%20Volume%20Control.py): `OpenCV Volume Control.py`

### Other components

- **User**
- **Webcam**
- **System Audio**
- **Volume Keys**

## Connections

- User → Distance Script: runs
- User → Gesture Script: runs
- Webcam → Frame Capture: provides frames
- Distance Script → Frame Capture: reads frames
- Frame Capture → Hand Landmarks: processes frames
- Distance Script → Distance Mapping: maps landmark distance
- Hand Landmarks → Distance Mapping: supplies coordinates
- Distance Script → Audio Endpoint: sets volume
- Distance Mapping → Audio Endpoint: provides level
- Audio Endpoint → System Audio: sets endpoint level
- Distance Script → Volume Overlay: draws indicator
- Distance Mapping → Volume Overlay: provides percentage
- Distance Script → Video Display: shows frame
- Volume Overlay → Video Display: draws on frame
- Webcam → Frame Capture: provides frames
- Gesture Script → Frame Capture: reads frames
- Frame Capture → Hand Landmarks: processes frames
- Gesture Script → Vertical Gesture: classifies finger ordering
- Hand Landmarks → Vertical Gesture: supplies positions
- Gesture Script → Volume Key Dispatch: dispatches keys
- Vertical Gesture → Volume Key Dispatch: selects volume key
- Volume Key Dispatch → Volume Keys: presses keys
- Gesture Script → Video Display: shows frame
- Hand Landmarks → Video Display: draws landmarks
