This project demonstrates a hand tracking system using OpenCV and MediaPipe to control the system volume through hand gestures. By tracking the position of your fingers, you can adjust the volume of your computer with simple gestures.
Hand tracking using MediaPipe. Gesture recognition for controlling system volume. Real-time feedback with visual indicators. Adjustable sensitivity for gesture recognition. Requirements Python 3.7+ OpenCV MediaPipe PyCaw (Python Core Audio Windows Library) Numpy
Clone the repository: git clone https://github.com/your-username/handtracking-gesture-volume-control.git cd handtracking-gesture-volume-control
Create and activate a virtual environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows use venv\Scripts\activate
pip install -r requirements.txt Usage Run the main script to start the hand tracking volume control:
python volume_control.py A window will open displaying the camera feed. Make sure your webcam is properly connected.
Thumb and Index Finger: Adjust the distance between your thumb and index finger to increase or decrease the volume. File Structure handtracking-gesture-volume-control/ │ ├── volume_control.py # Main script to run the hand tracking and volume control ├── handtracking_module.py # Module for hand tracking functions ├── README.md # Project documentation ├── requirements.txt # List of dependencies └── utils/ # Utility functions and additional scripts
The volume_control.py script initializes the webcam feed and uses MediaPipe to detect and track hand landmarks. The distance between specific landmarks on the hand (thumb and index finger) is calculated to determine the desired volume level. The PyCaw library is used to interface with the system's audio and adjust the volume accordingly. Troubleshooting Ensure your webcam is working and properly connected. If the hand tracking is not accurate, try adjusting the lighting in your environment. Ensure all dependencies are correctly installed.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.