https://github.com/shib-sankar-das/hand-gesture-volume-controller
https://github.com/shib-sankar-das/hand-gesture-volume-controller
computer-vision mediapipe opencv python webcam
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/shib-sankar-das/hand-gesture-volume-controller
- Owner: Shib-Sankar-Das
- License: mit
- Created: 2024-11-08T12:26:43.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-08T12:33:51.000Z (over 1 year ago)
- Last Synced: 2025-01-13T05:29:37.603Z (over 1 year ago)
- Topics: computer-vision, mediapipe, opencv, python, webcam
- Language: Python
- Homepage:
- Size: 9.77 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ποΈ Hand Gesture Volume Controller
Welcome to the **Hand Gesture Volume Controller** project! This project leverages computer vision and hand-tracking technology to control your device's volume simply by using hand gestures. Say goodbye to reaching for volume buttons β now, just pinch or move your fingers to adjust the volume effortlessly! πΆ
---
## π Table of Contents
- [Introduction](#introduction)
- [Features](#features)
- [Project Approach](#project-approach)
- [How to Run](#how-to-run)
- [Libraries Used](#libraries-used)
- [Screenshots](#screenshots)
- [License](#license)
---
## π₯οΈ Introduction
This project uses **OpenCV** and **MediaPipe** to track hand movements in real-time through your webcam, and **PyCaw** to interact with the system's audio. It uses a simple yet effective method to recognize hand gestures, specifically the pinch motion, to increase or decrease the volume. Designed to be intuitive and smooth, the program runs in the background without needing any physical interaction with your deviceβs audio controls.
---
## β¨ Features
- **Real-Time Hand Tracking** β Detects hands and fingers in real-time using a webcam.
- **Gesture-Based Volume Control** β Adjust the volume by moving your fingers closer or apart.
- **Visual Feedback** β Displays visual cues on the screen for an enhanced user experience.
- **Dynamic Range Control** β Automatically maps hand movement range to volume control range.
- **Smooth Operation** β Gesture smoothing for a more stable volume adjustment.
---
## π Project Approach
The project combines **MediaPipe's hand-tracking capabilities** with **PyCaw's audio control**. Hereβs how it works:
1. **Hand Detection**: MediaPipe locates and tracks hands, recognizing key landmarks.
2. **Gesture Recognition**: Specific landmarks on fingers (such as the thumb and index finger) are monitored to detect gestures.
3. **Distance Calculation**: Using Euclidean distance between landmarks, the pinch gesture is recognized and translated into volume control commands.
4. **Volume Adjustment**: Based on the distance between landmarks, the system maps the gesture range to the device's volume range and sets the volume level accordingly.
5. **Real-Time Display**: Provides real-time feedback on screen, showing the volume level, percentage, and current FPS.
---
## βοΈ How to Run
1. **Clone the Repository**:
```bash
git clone https://github.com/Shib-Sankar-Das/Hand-Gesture-Volume-Controller.git
```
2. **Install Required Libraries**:
Ensure you have Python 3.x installed, then install dependencies:
```bash
pip install opencv-python mediapipe pycaw numpy comtypes
```
3. **Run the Script**:
```bash
python HandGestureVolumeControl.py
```
*Note: Ensure your system has a working webcam.*
4. **Adjust Volume with Your Hand**:
- Use your thumb and index finger in a pinch gesture.
- Moving fingers closer or farther apart will decrease or increase the volume, respectively.
---
## π Libraries Used
- **OpenCV** β For video capture and image processing.
- **MediaPipe** β For hand tracking and gesture recognition.
- **PyCaw** β To interact with the system's audio control.
- **Numpy** β For mathematical operations.
- **Comtypes** β For working with Windows COM objects (required by PyCaw).
---
## πΈ Screenshots
Here are some example screenshots of the Hand Gesture Volume Controller in action!
