This application enables contactless control of your computer's system volume and screen brightness using hand gestures captured through your webcam. It utilizes computer vision and hand tracking technology to interpret hand movements and convert them into system control commands.
- Dual Hand Control:
- Left hand controls screen brightness
- Right hand controls system volume
- Real-time Processing: Instant response to hand movements
- Visual Feedback: On-screen display of hand tracking and gesture lines
- Natural Gesture Interface: Control through intuitive pinch movements
- Computer cam / Webcam (optional)
- Computer with audio output capabilities
- Display with adjustable brightness
pip install opencv-python
pip install mediapipe
pip install numpy
pip install comtypes
pip install pycaw
pip install screen-brightness-control
- Install all required dependencies using pip
- Download the
volume_brightness_control.py
script - Ensure your webcam is connected and functioning
- Run the script using Python 3.x
- Open terminal/command prompt
- Navigate to the script directory
- Run:
python volume_brightness_control.py
- Show your right hand to the camera
- Pinch your thumb and index finger together
- Adjust the distance between fingers:
- Increase distance β Increase volume
- Decrease distance β Decrease volume
- Range: 15-200 pixels maps to system volume range
- Show your left hand to the camera
- Pinch your thumb and index finger together
- Adjust the distance between fingers:
- Increase distance β Increase brightness
- Decrease distance β Decrease brightness
- Range: 15-200 pixels maps to 0-100% brightness
- Press 'q' to quit the application
- Uses MediaPipe Hands for hand landmark detection
- Minimum detection confidence: 75%
- Tracks 21 3D hand landmarks per hand
- Distinguishes between left and right hands
# Volume range mapping
volMin, volMax = volume.GetVolumeRange()[:2]
# Distance to volume conversion
vol = np.interp(length, [15, 200], [volMin, volMax])
# Brightness range mapping
bright = np.interp(length, [15, 200], [0, 100])
- Video Capture: OpenCV VideoCapture
- Hand Processing:
- MediaPipe hand detection
- Landmark extraction
- Hand side classification
- Gesture Measurement:
- Euclidean distance calculation between landmarks
- Linear interpolation for control mapping
- System Control:
- PyCaw for audio control
- screen_brightness_control for display brightness
Modify the interpolation ranges in the code:
# For brightness (default)
bright = np.interp(length, [15, 200], [0, 100])
# For volume (default)
vol = np.interp(length, [15, 200], [volMin, volMax])
To contribute to this project:
- Fork the repository
- Create a feature branch
- Implement your changes
- Submit a pull request
This project is released under the MIT License
- Project By: Curious Programmer