Control your computer mouse using hand gestures via your webcam — no physical mouse needed!
- Real-time hand detection with MediaPipe
- Move mouse with index finger
- Left-click gesture (index + thumb)
- Take screenshot gesture (middle + thumb)
- Works on any screen resolution
- Fast, lightweight & easy to use
Virtual-Mouse
- main.py # Main file to run the app
- hand_tracking.py # Hand detection module
- gesture_control.py # Gesture recognition & mouse control
- screenshot.png # Saved screenshot
- README.md # Project documentation
- Python
- OpenCV – for video capture and image processing
- MediaPipe – for hand tracking
- PyAutoGUI – to control mouse & take screenshots
- NumPy – for distance calculation
# Clone the repository
git clone https://github.com/vikas-tikapur/Virtual-Mouse.git
cd Virtual-Mouse
# (Optional) create virtual environment
python -m venv .venv
.venv\Scripts\activate # On Windows
# Install required packages
pip install opencv-python mediapipe pyautogui numpy-
python main.py
-
Press q to quit the program.
| Gesture | Action |
|---|---|
| Index Finger | Move the mouse |
| Index + Thumb | Left Click |
| Middle + Thumb | Take Screenshot |
-
Ensure good lighting for accurate hand detection.
-
Screenshot will be saved as screenshot.png in the project folder.
-
You can adjust click/screenshot sensitivity in gesture_control.py
- Vikas Mishra
- 🔗 GitHub: vikas-tikapur
