This project is a Python-based Virtual Mouse that uses your webcam to track hand gestures and control your computerβs cursor. It leverages MediaPipe for hand detection and PyAutoGUI for cursor control and clicking.
- Move the mouse cursor using your index finger.
- Perform mouse clicks by bringing your thumb and index finger close together.
- Real-time webcam-based hand tracking.
- No additional hardware required.
- Python
- MediaPipe β Hand landmark detection
- OpenCV β Image processing and webcam feed
- PyAutoGUI β Mouse control
git clone https://github.com/your-username/virtual-mouse-hand-gesture.git
cd virtual-mouse-hand-gesture- Install Dependencies Make sure you have Python 3.7 or later. Install the required libraries:
bash Copy Edit pip install opencv-python mediapipe pyautogui 3. Run the Script bash Copy Edit python cursor.py Allow webcam access when prompted.
π― How It Works The webcam captures your hand in real-time.
MediaPipe identifies hand landmarks.
If the index finger tip (landmark id 8) is detected, the cursor is moved.
If the thumb tip (landmark id 4) comes close to the index finger tip, a mouse click is triggered.
π§ Future Enhancements Add support for drag and drop.
Enable scrolling gestures.
Improve accuracy with smoothing algorithms.
Add GUI controls for sensitivity and gesture calibration.
π‘οΈ Disclaimer This is a prototype and may not work perfectly across all lighting conditions or camera resolutions.
π Acknowledgements MediaPipe by Google
PyAutoGUI Documentation
π§βπ» Author Raj Verma Feel free to contribute, fork, or suggest improvements!