This Python project uses hand gestures captured via a webcam to control the volume of your laptop. The project leverages OpenCV for image processing, MediaPipe for hand tracking, and Pycaw for volume control.
- Real-time hand tracking using a webcam.
- Control system volume by changing the distance between the thumb and index finger.
- Visual feedback showing the current volume level on the webcam feed.
Before running the project, you need to install the required dependencies. Use pip to install them:
pip install opencv-python mediapipe pycaw- Clone the repository or download the script.
- Open a terminal and navigate to the directory containing the script.
- Run the script using Python:
python volume_control.py- The webcam feed will open. Place your hand in front of the camera, and adjust the volume by moving your thumb and index finger closer or further apart.
- Press 'q' to exit the application.
- MediaPipe is used for hand tracking, identifying the positions of the thumb and index finger.
- PyCaw controls the system volume based on the distance between the thumb and index finger.
- OpenCV handles the webcam feed and drawing of landmarks and feedback text on the screen.
- The script initializes MediaPipe for hand tracking and PyCaw for volume control.
- The webcam feed is processed frame by frame.
- Hand landmarks are detected, and the positions of the thumb tip and index finger tip are identified.
- The Euclidean distance between these two points is calculated.
- This distance is mapped to the volume range of the system.
- The system volume is adjusted accordingly, and the current volume level is displayed on the screen.