This project allows you to control your computer's system volume using hand gestures. By detecting the distance between your thumb and index finger, the app adjusts the system volume accordingly. It uses the MediaPipe library for hand tracking, pycaw for controlling system volume, and OpenCV for real-time video processing.
- Hand Gesture Recognition: Uses MediaPipe to detect hand landmarks and track the distance between the thumb and index finger.
- Volume Control: Adjusts the system's master volume based on the detected hand gesture. The closer the thumb and index finger are, the lower the volume; the further apart they are, the higher the volume.
- Real-time Feedback: Displays the current volume percentage and the hand gesture distance on the video feed.
To run this project, you need to install the following Python libraries:
opencv-pythonmediapipepycawnumpycomtypes
You can install these dependencies using the following command:
pip install opencv-python mediapipe pycaw numpy comtypes- Hand Tracking: The app uses the MediaPipe library to track hand landmarks in real-time using the webcam.
- Volume Calculation: It calculates the distance between the thumb (landmark 4) and the index finger (landmark 8).
- Volume Mapping: The distance between these two landmarks is mapped to the system's volume range.
- Volume Adjustment: Using the pycaw library, the system's volume is adjusted based on the calculated distance.
- Run the script to launch the webcam feed.
- Position your hand in front of the camera with the thumb and index finger visible.
- Adjust the distance between your thumb and index finger to control the volume. As you move them apart, the volume increases. Moving them closer together decreases the volume.
- The current volume level will be displayed on the screen.
- Press
Qto exit the program.
This project is licensed under the MIT License - see the LICENSE file for details.