A real-time hand gesture-based volume control application that allows users to control their device volume using hand gestures!
- Hand Gesture Recognition: Uses MediaPipe for accurate hand landmark detection
- Real-time Volume Control: Adjusts system volume based on finger distance
- Visual Feedback: Live camera feed with volume bar and percentage display
- Modern UI: Built with Kivy/KivyMD framework
- Windows Audio Integration: Native Windows audio control via pycaw
The app detects hand gestures through your webcam and measures the distance between your thumb and index finger. The measured distance is then translated into volume levels:
- Bring fingers closer: Decrease volume
- Spread fingers apart: Increase volume
- Python 3.8 or higher
- Windows OS (for audio control features)
- Webcam/Camera
-
Clone this repository:
git clone <repository-url> cd Gesture_App
-
Install dependencies:
pip install -r requirements.txt
-
Run the application:
python main.py
On Windows:
build.batOn Linux/Mac:
chmod +x build.sh
./build.shThe executable will be created in the dist/ folder.
- Launch the application
- Click the "Click" button to start the camera
- Show your hand to the camera
- Adjust volume by changing the distance between your thumb and index finger
- The volume bar on the left shows the current volume level
Gesture_App/
├── main.py # Main application file
├── helper.py # Hand detection helper module
├── requirements.txt # Python dependencies
├── GestureApp.spec # PyInstaller configuration
├── build.bat # Windows build script
├── build.sh # Linux/Mac build script
└── README.md # This file
- kivy: GUI framework
- kivymd: Material Design components for Kivy
- opencv-python: Computer vision and camera handling
- mediapipe: Hand landmark detection
- numpy: Numerical operations
- pycaw: Windows audio control
- comtypes: COM interface support (Windows)
- pyinstaller: Executable packaging
-
MainApp: Main Kivy application class- Initializes camera, hand detector, and audio interface
- Handles real-time video processing
- Updates volume based on hand gestures
-
handDetector(helper.py): Hand detection wrapperfindHands(): Detects and draws hand landmarksfindPosition(): Returns hand landmark positions
To create a distributable executable:
- Ensure all dependencies are installed
- Run the build script for your platform
- Find the executable in
dist/GestureVolumeControl.exe(Windows) ordist/GestureVolumeControl(Linux/Mac)
Camera not detected:
- Check if your camera is properly connected
- Ensure no other application is using the camera
- Try changing the camera index in main.py (line 60)
Audio control not working:
- Ensure you're running on Windows
- Check that your audio devices are properly configured
- Run as administrator if needed
Import errors:
- Verify all dependencies are installed:
pip install -r requirements.txt - Use a virtual environment to avoid conflicts
- Fixed critical math bug in distance calculation (line 106)
- Replaced deprecated
.tostring()with.tobytes()for OpenCV compatibility - Added comprehensive error handling
- Fixed class name typo (handDectector → handDetector)
- Changed default camera index from 1 to 0
- Removed unused imports
- Added proper resource validation
This project is open source and available for educational purposes.
Contributions are welcome! Please feel free to submit pull requests or open issues for bugs and feature requests.
- MediaPipe for hand tracking technology
- Kivy/KivyMD for the GUI framework
- OpenCV for computer vision capabilities