A computer-vision project that allows users to control mouse movement through real-time hand gestures captured by a webcam.
The project uses Python, OpenCV, MediaPipe and PyAutoGUI to detect hand landmarks, interpret gestures and translate them into mouse actions.
This is an educational and experimental project created to demonstrate real-time hand tracking and human-computer interaction using computer vision.
- Real-time hand detection
- Hand-landmark tracking
- Cursor movement using finger position
- Mouse-click gestures
- Webcam-based interaction
- On-screen landmark visualisation
- Frame-rate monitoring
Only gestures present in the current Python implementation should be considered supported.
- Python
- OpenCV
- MediaPipe
- PyAutoGUI
- NumPy
gesture-controlled-virtual-mouse/
├── HandTracker.py
├── HandTrackingModule.py
├── assets/
│ └── .gitkeep
├── README.md
├── requirements.txt
├── .gitignore
└── LICENSE
The main application file. It opens the webcam, uses the supporting module, reads landmark positions, interprets gestures and performs supported mouse actions.
The reusable supporting module responsible for initialising MediaPipe, processing frames, drawing landmarks and returning landmark positions.
If your supporting module has a different filename, update this README and ensure the import inside HandTracker.py matches it.
git clone https://github.com/namanofficial10/gesture-controlled-virtual-mouse.git
cd gesture-controlled-virtual-mouse
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtOn Windows:
python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txtpython HandTracker.pyOn some systems:
python3 HandTracker.pyAllow camera access when prompted.
- OpenCV captures webcam frames.
- MediaPipe detects the hand and landmark points.
- The supporting module returns landmark coordinates.
- The main file evaluates finger positions and gestures.
- Webcam coordinates are mapped to the screen.
- PyAutoGUI performs the corresponding mouse action.
A demo is not currently included.
Later, add a GIF at:
assets/demo.gif
Then include:
Hide notifications and personal information before recording.
- Webcam frames are processed locally.
- This project is not intended to upload or store camera footage.
- Review the source before running and confirm no recording or network logic has been added.
- Camera permissions can be revoked after use.
- Accuracy depends on lighting and camera quality.
- Cluttered backgrounds may reduce detection quality.
- Fast movement may cause cursor instability.
- Dependency compatibility can vary by Python version.
- This project has not been validated as a production accessibility tool.
- Cursor smoothing and calibration
- Configurable gestures
- Drag-and-drop support
- Scrolling and right-click controls
- Multi-hand filtering
- Low-light improvements
- Automated tests
- Sensitivity settings
- Desktop packaging
- Demo GIF
Check camera permissions, close other camera applications and verify the camera index in HandTracker.py.
Keep both Python files in the same directory and ensure the supporting module filename matches the import statement.
Improve lighting, keep the hand fully visible and adjust smoothing or frame-margin values.
Use this project only for learning, experimentation and authorised human-computer interaction research.
Naman Sharma
- Portfolio: https://namanofficial10.github.io/
- GitHub: https://github.com/namanofficial10
This project is available under the MIT Licence. See LICENSE.