A Python-based volume controller using OpenCV and MediaPipe that allows you to control your system volume with simple hand gestures via webcam.
- 📷 Real-time hand tracking using MediaPipe
- ✋ Control system volume by changing the distance between your thumb and index finger
- 🔊 Visual feedback for volume level on screen
- 🧠 Intuitive gesture-based interface
Install the required libraries:
pip install opencv-python mediapipe numpy pycaw comtypesNote:
pycawonly works on Windows.
- Clone the repository:
git clone https://github.com/Yamii07/volume-controller-hand-gestures.git
cd volume-controller-hand-gestures- Run the script:
python volume_control.py- Show your hand to the webcam and pinch your thumb and index finger to adjust the volume.
- MediaPipe detects hand landmarks in real time.
- Calculates the distance between landmark 4 (thumb tip) and landmark 8 (index finger tip).
- Maps that distance to a system volume range (0% - 100%).
- Adjusts volume using pycaw on Windows.
volume-controller-hand-gestures/
├── htmmod.py # Modules for main File
├── volume_control.py # Main script
├── README.md # Project documentation
- 3.6 < Python < 3.12
- Webcam
- Windows OS (required for volume control)
Purshottam Kumar
GitHub: @Yamii07
This project is licensed under the MIT License. See the LICENSE file for details.