A Python project using OpenCV and MediaPipe for real-time hand tracking and gesture-based system volume control.
[Add a GIF or video showing it working]
This project leverages computer vision to recognize hand gestures from webcam input and control the system volume based on finger positions.
- Python 3.x
- OpenCV - For capturing webcam video and processing images
- MediaPipe - For hand landmark detection
- pycaw - For controlling system volume on Windows
pip install opencv-python mediapipe pycaw comtypesOr install from requirements.txt:
pip install -r requirements.txtpython src/Finalproject.py- Show your hand to the webcam
- Pinch gesture (thumb and index finger) controls the volume
- Press
QorEscto quit
- Real-time hand tracking
- Gesture-based volume control
- FPS display
- Visual feedback with landmarks and volume bar
- Detects fingertip positions and distance between fingers
- Add more gestures
- Improve accuracy
- Support for multiple platforms (currently Windows-only)
- Add gesture customization options
The project is organized as follows:
- src/ - Contains all Python source files
1_basicvideocapturing.py- Basic webcam video capturing2_basichandrecognition.py- Basic hand detection using MediaPipe3_Connecttipsoffinger.py- Connects tips of fingers4_addcircletofingertips.py- Draws circles on fingertip positions5_showfps.py- Displays frames per second on video6_Calculatingthedistancebetweenfingers.py- Calculates distance between fingertips7_makingbarwithdistance.py- Creates a bar to visualize distance/volume8_connectingwithsystemvolume.py- Controls system volume via finger distanceFinalproject.py- Main project file combining all features
- docs/ - Documentation files
requirements.txt- Python package dependenciesLICENSE- MIT LicensePoster.jpg- Project poster image
- Python 3.7+
- Windows OS (pycaw is Windows-specific)
- Webcam
- The webcam stream is processed in real-time.
- Hand landmarks are detected using MediaPipe.
- The distance between thumb and index fingertip is calculated.
- This distance is mapped to the system volume range using pycaw.
- Visual feedback (landmarks, lines, circles, volume percentage, FPS, and a volume bar) is displayed on the window.
Made by Chinmay048
