https://github.com/maanjk/hand-gesture-virtual-mouse
Control your Windows mouse using hand gestures and a webcam with OpenCV and MediaPipe (move, click, drag, scroll).
https://github.com/maanjk/hand-gesture-virtual-mouse
ai computer-vision hand-tracking mediapipe opencv python virtual-mouse virtual-mouse-using-hand-gesture
Last synced: about 2 months ago
JSON representation
Control your Windows mouse using hand gestures and a webcam with OpenCV and MediaPipe (move, click, drag, scroll).
- Host: GitHub
- URL: https://github.com/maanjk/hand-gesture-virtual-mouse
- Owner: maanjk
- License: mit
- Created: 2025-12-04T18:33:41.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2025-12-04T18:58:53.000Z (7 months ago)
- Last Synced: 2025-12-08T02:37:39.341Z (6 months ago)
- Topics: ai, computer-vision, hand-tracking, mediapipe, opencv, python, virtual-mouse, virtual-mouse-using-hand-gesture
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AI Virtual Mouse (Hand-Gesture Controlled Cursor)
Control your mouse cursor using only your hand and a webcam.
This project uses **OpenCV** and **MediaPipe Hands** to track your fingers in real time and map simple hand gestures to mouse actions.
> Tested on: Windows, Python 3.10, CPU-only
---
## β¨ Features
- π± **Cursor movement** β move the mouse pointer with your index finger
- π **Left click & double-click** β pinch **index + middle** fingers
- β **Drag and drop** β make a **fist** to grab, open your hand to release
- βββ **Scroll** β raise **3 fingers** (index, middle, ring) and move your hand up/down
- π **On-screen help** β live βModeβ text and gesture instructions drawn on the webcam feed
The implementation is lightweight and runs fully on the CPU using your normal webcam.
---
## π§° Requirements
- **Python**: 3.10 (recommended)
- **OS**: Windows (tested)
- **Hardware**: Any basic webcam
### Python dependencies
Defined in `requirements.txt`:
```text
opencv-python
mediapipe
numpy
pyautogui
```
---
## π Installation
Clone the repo and set up a virtual environment.
## Bash
```text
# 1. Clone the repository
git clone https://github.com/maanjk/hand-gesture-virtual-mouse.git
cd hand-gesture-virtual-mouse
# 2. Create a virtual environment (Windows)
python -m venv venv
# 3. Activate the virtual environment (Windows)
venv\Scripts\activate
# 4. Install dependencies
pip install -r requirements.txt
```
## On macOS / Linux, activation would be:
```text
source venv/bin/activate
```
## βΆοΈ Usage
Bash
```text
python virtual_mouse.py
A window titled "AI Virtual Mouse" will open.
Press q (with the window focused) to quit.
```