Skip to content

DamsaraJayanath/Virtual_Mouse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ–ฑ๏ธ Virtual Mouse Using Hand Tracking

This project is a real-time virtual mouse system built using Python, OpenCV, MediaPipe, and Autopy. It allows users to control their system's mouse cursor and perform click actions using hand gestures captured by a webcam.

๐Ÿ”ง Features

  • Tracks hand landmarks using MediaPipe
  • Moves the mouse cursor with the index finger
  • Performs left click when index and middle fingers are close together
  • Works in real time with high accuracy and responsiveness
  • Draws visual guides (cursor area and gesture feedback) on screen

๐Ÿ›  Technologies Used

  • Python
  • OpenCV
  • MediaPipe
  • Autopy (for controlling mouse cursor)
  • NumPy

๐Ÿ“‚ File Structure

  • HandTrackingModule.py: Contains reusable hand detection class and gesture utilities
  • mouse.py: Main application to control the virtual mouse using hand gestures

๐Ÿ“Œ How It Works

  1. The webcam captures real-time video input.
  2. HandTrackingModule.py detects hand landmarks using MediaPipe.
  3. The system tracks the index finger to move the cursor across the screen.
  4. When both index and middle fingers are extended and close together, it performs a left click.
  5. Visual cues and gesture rectangles are shown to guide user interaction.

โ–ถ๏ธ Usage

Run the following command to start the virtual mouse system:

python mouse.py

Press q to quit the program.

โš ๏ธ Requirements

  • Webcam
  • Windows/macOS/Linux
  • Python packages:
    • opencv-python
    • mediapipe
    • autopy
    • numpy

Install all dependencies:

pip install opencv-python mediapipe autopy numpy

๐Ÿ’ก Tip

For best accuracy, make sure your hand is well-lit and centered in the webcam view. Try different distances to see how movement sensitivity adjusts.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages