This project demonstrates how to use computer vision to create a gesture-based volume controller. It uses OpenCV and MediaPipe to track hand gestures and adjust the system volume dynamically.
- Hand Tracking Module: Detect and track hand landmarks using MediaPipe.
- Coordinate Testing: Retrieve and print landmark coordinates in real-time.
- Finger Counter: Detect the number of fingers shown using custom logic.
- Volume Controller: Adjust system volume based on the distance between two fingers.
- Python 3.x
- OpenCV
- MediaPipe
- Pycaw (for audio control)
visual-volume-control/ │ ├── HandTrackingModule.py # Hand tracking logic encapsulated in a module ├── FingerCounter.py # Detects number of fingers shown ├── VolumeControl.py # Gesture-controlled volume adjustment ├── FingerImages/ # Folder containing images for finger counting ├── README.md # Project documentation (this file)file)
- Clone the Repository:
git clone https://github.com/yaarya/visual-volume-control.git cd visual-volume-control - Install Required Libraries:
pip install opencv-python-headless mediapipe comtypes numpy pycaw
- Run the Volume Controller:
python VolumeControl.py
- The program opens the webcam feed.
- Show two fingers (thumb + index) to adjust volume.
- Move fingers closer to reduce volume and spread them apart to increase it.
- Real-time FPS is displayed on the video feed.
- Add gesture-based media controls (e.g., play/pause).
- Implement a GUI for smoother interaction.
- Integrate with smart home systems.