Skip to content

A Python project using MediaPipe to control the system volume through hand gestures detected via webcam. Adjust the volume by moving your thumb and index finger apart or closer together.

License

Notifications You must be signed in to change notification settings

brianrscode/hand-volume-control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hand Volume Control

This project uses the MediaPipe library to detect hands and control the system volume through finger gestures. Detection is performed via the webcam and adjusts the volume based on the distance between the thumb and index finger.

Requirements

  • Python 3.7+
  • OpenCV
  • MediaPipe
  • NumPy
  • pycaw
  • comtypes

Installation

  1. Clone this repository:
git clone https://github.com/brianrscode/hand-volume-control.git
cd hand-volume-control
  1. Install the dependencies:
pip install -r requirements.txt

Usage

  1. Run the main script:
python main.py
  1. Make sure your webcam is on and visible.
  2. Adjust the volume by bringing the thumb and index finger together and moving them apart or closer.

Project Structure

  • HandsDetector.py: Contains the HandsDetector class for hand detection and tracking using MediaPipe.

  • main.py: Main script to run hand detection and volume control.

Code Description

HandsDetector

The HandsDetector class provides methods to:

  • Detect hands in a video frame.
  • Find positions of hand landmarks.
  • Determine which fingers are up.
  • Calculate the distance between two specific landmarks.

main.py

The main script:

  • Sets up video capture from the webcam.
  • Uses the HandsDetector class to detect hands and get landmark positions.
  • Calculates the distance between the thumb and index finger to adjust the system volume.

About

A Python project using MediaPipe to control the system volume through hand gestures detected via webcam. Adjust the volume by moving your thumb and index finger apart or closer together.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages