Control volume with hand gestures! ✋ This Python project utilizes MediaPipe to track your hand and adjust system volume based on finger distance. A volume bar and indicator provide real-time feedback.
Features:
- Intuitive Control: Pinch your thumb and index finger to adjust volume smoothly.
- Visual Feedback: A clear volume bar and percentage indicator keep you informed.
- Ring Finger Lock: Prevents unintentional changes by requiring your ring finger to be down.
How it Works:
- Hand Detection: MediaPipe tracks your hand in real-time using your webcam.
- Landmark Extraction: Identifies key points on your hand (fingertips).
- Distance Calculation: Calculates the distance between your thumb and index finger.
- Volume Mapping: Maps the distance to a corresponding volume level (0-100%).
- Volume Adjustment: Uses Pycaw to adjust system volume based on the calculated level.
Requirements:
- Python 3.x
- OpenCV (cv2)
- MediaPipe
- NumPy
- pycaw
- Hand Tracking Module (replace with custom module or public link)
Usage:
- Clone or download the repository.
- Install required libraries:
pip install opencv-python mediapipe numpy pycaw(assuminghandtrackingmoduleis already installed). - Run the main script (
hand_volume_control.pyor equivalent). - Open your webcam and control volume with hand gestures!
Additional Notes:
This is a starting point. Consider customizing volume control behavior, adding visual effects, or integrating with different audio sources. Explore error handling and user feedback for a more robust experience.