Control your system volume using hand gestures through your webcam — no keyboard or mouse required! This project uses Python, MediaPipe, Flask, and PyAutoGUI to recognize gestures in real time and trigger volume control actions.
- 🖐️ Open Hand → Increases volume
- 👊 Fist → Decreases volume
- 👍 Thumb Up → Mutes/Unmutes
- 🔁 Live webcam feed directly in browser
- 💻 Works on all laptops and Windows PCs (no driver issues)
- ⚡ Real-time gesture recognition with smooth detection
| Component | Purpose |
|---|---|
| Python | Main programming language |
| OpenCV | Access and process webcam video feed |
| MediaPipe | Detect hand landmarks and gestures |
| Flask | Create a local web interface for visualization |
| PyAutoGUI | Simulate real system volume key presses |
git clone https://github.com/Pranava-M/hand-gesture-volume-control.git
cd hand-gesture-volume-controlRun these commands in your terminal (preferably inside a virtual environment):
pip install opencv-python mediapipe flask pyautoguihand_gesture_volume_control/
├── gesture_app.py
└── templates/
└── index.html
⚠️ Make sure theindex.htmlfile is inside a folder namedtemplates(Flask requires this).
-
Run the Python file:
python gesture_app.py
-
Open your browser and go to:
http://127.0.0.1:5000/ -
Allow camera access when prompted.
-
Show your hand gestures in front of the camera to control your volume!
-
Camera Feed The webcam captures live video frames using OpenCV.
-
Hand Detection (MediaPipe) MediaPipe detects 21 hand landmarks in each frame — tips, joints, and wrist points.
-
Gesture Recognition Using landmark positions:
- The program checks if each finger is raised or folded.
- The number and pattern of raised fingers determine which gesture is shown.
-
Action Trigger (PyAutoGUI) Each gesture sends a simulated keyboard command:
volumeup→ Increase volumevolumedown→ Decrease volumevolumemute→ Toggle mute/unmute
-
Web Display (Flask) Flask hosts a simple webpage that:
- Shows the live camera feed.
- Displays the detected gesture text dynamically.
| Gesture | Action | Description |
|---|---|---|
| 🖐️ Open Hand | Volume Up | Raise all five fingers clearly |
| 👊 Fist | Volume Down | Fold all fingers into a fist |
| 👍 Thumb Up | Mute / Unmute | Raise only your thumb |
| ✌️ Two Fingers | Detected as "2 Fingers" (no action) | Used just for testing recognition |
| 🤚 Other gestures | Detected count only | No volume change triggered |
💡 Ensure your hand is fully visible and well-lit for accurate detection.
| Problem | Possible Fix |
|---|---|
| ❌ “No Hand Detected” | Move your hand closer or adjust lighting |
| ❌ Camera not opening | Close other apps using the webcam |
| ❌ Volume not changing | Run Python as administrator (required for key events on some systems) |
| ❌ Laggy video | Lower resolution or close background processes |
Web Interface Preview:
✋ Hand Gesture Volume Control
Show your hand to the camera!
Detected Gesture: 🖐️ Open Hand (Volume Up)
- 🎵 Control media playback (play/pause/next)
- 🧠 Add AI-based gesture training for custom actions
- 💡 Show real-time on-screen volume bar
- 📱 Add mobile compatibility for gesture streaming
👨💻 Pranav Machireddy A simple yet futuristic project exploring computer vision and natural gesture interfaces.
This project is open-source under the MIT License – free to use, modify, and share.