This project enables users to control their computer mouse using hand gestures captured by their webcam. The system detects hand movements and finger gestures in real-time, translating them into corresponding mouse actions such as left-click, right-click, double-click, and scrolling up/down.
You must have Python version 3.9+ installed on your device. Following Modules need to be installed for proper working of the project :
- OpenCV
- NumPy
- Mouse
- cvzone (Custom Hand Tracking Module)
OpenCV (Open Source Computer Vision Library) is a powerful open-source computer vision and machine learning software library. It provides a wide range of functionalities for image and video analysis, including object detection, facial recognition, feature detection, and more.
Installation of this module :
pip install opencv-python
NumPy is a fundamental package for scientific computing with Python. It provides support for multidimensional arrays, matrices, and mathematical functions to operate on these arrays efficiently.In this project, NumPy is used for numerical operations, particularly for interpolating hand positions and performing calculations related to image processing.
Installation of this module :
pip install numpy
Mouse is a Python library that provides cross-platform functions for controlling the mouse cursor on a computer. It allows you to simulate mouse clicks, movements, scrolling, and other interactions programmatically.
Installation of this module :
pip install mouse
pip install opencv-python numpy mouse
Once you are done installing all dependencies you can run the program & can operate mouse with following actions :
- Index Finger: Controls the mouse cursor.
- Index + Middle Finger (distance between them becomes 2 cm): Left-click.
- Index + Middle + Ring Finger (distance between them becomes 2 cm): Right-click.
- Thumb + Index + Middle Finger: Scroll up.
- All Fingers Slightly Closed: Scroll down.
- This project supports single-hand control at a time (either left hand or right hand).
- You need to adjust the screen size in the code(depending upon the size of your screen for optimum performance)
- To know the exact size of your screen run scrn_size.py file
- Use a well-lit environment and ensure that your hand is clearly visible to the camera for optimal performance.
- Please note that speed and efficiency of this project may vary depending on factors such as hardware configuration and input data size.