Skip to content

Muhammed-als/HandDetecting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

HandDetecting

Real-time hand gesture control system built with MediaPipe and OpenCV.

This project uses your webcam to detect hand landmarks and lets you control:

  • System volume (right hand)
  • Screen brightness (left hand)
  • Mouse movement, click, and scrolling (right hand in mouse mode)

Features

  • Dual-hand tracking with MediaPipe Tasks API (hand_landmarker.task)
  • Auto-download of the hand landmark model if missing
  • Two control modes:
    • Media mode: volume, brightness, mute toggle
    • Mouse mode: virtual touchpad, click, and scroll
  • Real-time HUD overlay with FPS, active mode, and controls guide
  • Signal smoothing for stable volume/brightness and mouse movement

Requirements

  • Windows 10/11
  • Python 3.9+
  • Webcam

Install Dependencies

Run this in the project folder:

pip install opencv-python mediapipe numpy pycaw comtypes pyautogui screen-brightness-control

Notes:

  • screen-brightness-control is optional. If not installed, brightness control is simulated and a warning appears on screen.
  • First run may download hand_landmarker.task automatically from Google MediaPipe models.

Run

python HandTracking.py

Controls

Global

  • Press M to toggle between Media and Mouse modes
  • Press Q to quit

Media Mode

  • Right hand pinch (thumb + index): adjust system volume
  • Hold right-hand pinch near minimum for a short time: toggle mute/unmute
  • Left hand pinch (thumb + index): adjust screen brightness

Mouse Mode (Right Hand)

  • Index finger up only: move mouse cursor
  • Index + middle fingers up and close together: left click
  • Index + middle fingers up and apart: vertical hand movement scrolls page

How It Works

  1. Captures webcam frames using OpenCV.
  2. Runs MediaPipe Hand Landmarker on each frame.
  3. Classifies left/right hand and extracts landmarks.
  4. Maps gestures to OS actions:
    • Pycaw for master volume and mute
    • screen-brightness-control for brightness
    • PyAutoGUI for cursor, click, and scroll
  5. Draws a live HUD and hand skeleton overlay.

About

Real-time hand gesture control system built with MediaPipe and OpenCV.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages