Real-time hand gesture control system built with MediaPipe and OpenCV.
This project uses your webcam to detect hand landmarks and lets you control:
- System volume (right hand)
- Screen brightness (left hand)
- Mouse movement, click, and scrolling (right hand in mouse mode)
- Dual-hand tracking with MediaPipe Tasks API (
hand_landmarker.task) - Auto-download of the hand landmark model if missing
- Two control modes:
Mediamode: volume, brightness, mute toggleMousemode: virtual touchpad, click, and scroll
- Real-time HUD overlay with FPS, active mode, and controls guide
- Signal smoothing for stable volume/brightness and mouse movement
- Windows 10/11
- Python 3.9+
- Webcam
Run this in the project folder:
pip install opencv-python mediapipe numpy pycaw comtypes pyautogui screen-brightness-controlNotes:
screen-brightness-controlis optional. If not installed, brightness control is simulated and a warning appears on screen.- First run may download
hand_landmarker.taskautomatically from Google MediaPipe models.
python HandTracking.py- Press
Mto toggle betweenMediaandMousemodes - Press
Qto quit
- Right hand pinch (thumb + index): adjust system volume
- Hold right-hand pinch near minimum for a short time: toggle mute/unmute
- Left hand pinch (thumb + index): adjust screen brightness
- Index finger up only: move mouse cursor
- Index + middle fingers up and close together: left click
- Index + middle fingers up and apart: vertical hand movement scrolls page
- Captures webcam frames using OpenCV.
- Runs MediaPipe Hand Landmarker on each frame.
- Classifies left/right hand and extracts landmarks.
- Maps gestures to OS actions:
- Pycaw for master volume and mute
- screen-brightness-control for brightness
- PyAutoGUI for cursor, click, and scroll
- Draws a live HUD and hand skeleton overlay.