How laith-kalfood/gesture-led-control works
A single Python script implements the runtime: it captures webcam frames, detects hands and gates control on a raised index finger, maps pinky–thumb distance to PWM brightness, and sends the value to an Arduino. It also overlays hand landmarks and the measured span for visual feedback. The README documents the Arduino/PyFirmata setup and intended gesture. There are no separate source modules or storage layers; relationships shown here are evidenced by the script, while external hardware and libraries are represented as actors/services.
Main entry points: KReader.py Frame capture
Components 15
Gesture controller
- Frame capture
KReader.py - Hand detection
KReader.py - Index finger gate
KReader.py - Finger distance
KReader.py - Brightness mapping
KReader.py - PWM output
KReader.py - Gesture overlay
KReader.py - Video display
KReader.py - Shutdown
KReader.py
External interfaces
- Webcam
- OpenCV
- MediaPipe Hands
- PyFirmata2
- Arduino PWM
Other components
- User gestures
Connections 17
- User gestures → Webcam: gestures in view
README.md - Webcam → Frame capture: frames
KReader.py - Frame capture → OpenCV: reads frames
KReader.py - Frame capture → Hand detection: passes RGB frame
KReader.py - Hand detection → MediaPipe Hands: processes frame
KReader.py - Hand detection → Index finger gate: landmarks
KReader.py - Index finger gate → Finger distance: enables on index
KReader.py - Finger distance → Brightness mapping: distance
KReader.py - Brightness mapping → PWM output: brightness value
KReader.py - PWM output → PyFirmata2: writes pin
KReader.py - PyFirmata2 → Arduino PWM: PWM signal
README.md - Hand detection → Gesture overlay: draws landmarks
KReader.py - Finger distance → Gesture overlay: draws finger span
KReader.py - Gesture overlay → Video display: annotated frame
KReader.py - Video display → OpenCV: shows video
KReader.py - Frame capture → Shutdown: Q key exits loop
KReader.py - Shutdown → Arduino PWM: closes board
KReader.py