A Python-based virtual mouse system that uses computer vision and hand tracking to control the cursor and perform mouse clicks with a webcam.
This project combines OpenCV, MediaPipe, and Autopy to detect hand landmarks and translate simple hand gestures into mouse interaction.
- Move the cursor by pointing with your index finger
- Click by bringing the index and middle fingers close together
- Exit the application by pressing
q
AiVirtualMouseProject.py– Main script that captures the webcam feed and maps gesture movement to mouse actionsHandTrackingModule.py– Hand landmark detector and utility module used by the main project
This project was verified to run on Python 3.8.10 using the following interpreter:
C:\Users\Astro\AppData\Local\Python\pythoncore-3.8-64\python.exeVerified working library versions in that environment:
opencv-python==5.0.0
numpy==1.22.4
mediapipe==0.10.5
autopy==import verified under Python 3.8Install the required dependencies with:
pip install opencv-python==5.0.0 numpy==1.22.4 mediapipe==0.10.5 autopy- Open a terminal in the project directory.
- Run the main file using the same Python 3.8 interpreter:
C:\Users\Astro\AppData\Local\Python\pythoncore-3.8-64\python.exe -u "d:\E249_SEM_5\PROJECTS\VirtualMouse\AiVirtualMouseProject.py"- Keep your hand in front of the webcam.
- Use the gestures described above to control the mouse.
- A webcam is required for the hand-tracking feature to work.
- This repository is shared mainly for the source code implementation.
- Python 3.8.10 is the tested runtime for this project due to the library versions used here.