Skip to content

Vineet90x/Volume-Control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Volume-Control

Volume Control with Hand Gestures

Introduction

This project demonstrates how to control your system volume using hand gestures. The implementation utilizes computer vision techniques, specifically Mediapipe for hand tracking and OpenCV for image processing, along with Pycaw for controlling the system audio.

Features

  • Real-time Hand Tracking: Uses Mediapipe to detect and track hand landmarks in real-time.
  • Gesture Recognition: Recognizes the distance between thumb and index finger to adjust the system volume.
  • Volume Control: Interacts with the system's audio settings using Pycaw to set the volume based on the recognized gestures.

Installation

  1. Clone the Repository

    git clone https://github.com/yourusername/Volume-Control.git
    cd Volume-Control
  2. Create a Virtual Environment

    python -m venv venv
    source venv/bin/activate   # For Unix or MacOS
    venv\Scripts\activate      # For Windows
  3. Install the Required Packages

    pip install -r requirements.txt
  4. Run the Script

    python main.py

Usage

  1. Ensure your webcam is connected and working.
  2. Run the main.py script.
  3. The script will open a window displaying the camera feed.
  4. Use your hand gestures to control the volume:
    • Move your thumb and index finger closer or apart to decrease or increase the volume.
    • A visual feedback bar on the screen indicates the current volume level.

Code Overview

The main components of the project include:

  • Hand Detection and Tracking: Utilizes Mediapipe's Hand module to detect and track hand landmarks.
  • Distance Calculation: Calculates the distance between thumb and index finger to determine the gesture.
  • Volume Control: Uses Pycaw to set the system volume based on the gesture.

Key Sections of the Code

  • Initialization: Set up Mediapipe, Pycaw, and OpenCV.
  • Hand Landmark Detection: Detect and draw hand landmarks on the webcam feed.
  • Gesture Recognition: Calculate the distance between specific landmarks (thumb and index finger) to determine the gesture.
  • Volume Adjustment: Map the gesture distance to the system volume range and adjust accordingly.

Output

volume control output (1)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages