This Python script tracks hand movements using a webcam feed and performs mouse clicking actions based on specific gestures. It utilizes the Mediapipe library for hand detection and PyAutoGUI for simulating mouse clicks.
- Python 3.x
- OpenCV (
pip install opencv-python) - Mediapipe (
pip install mediapipe) - PyAutoGUI (
pip install pyautogui)
-
Clone the repository or download the Python script (
HandTracking.py) to your local machine. -
Install the required dependencies using
pip install -r requirements.txtThis will install the necessary Python packages (opencv-python,mediapipe, andpyautogui) for running the script. -
Run the Python script using the following command:
py HandTracking.py- Position your hand in front of the webcam and perform specific gestures to trigger mouse clicking actions.
-
The script uses the OpenCV library to capture frames from the webcam feed.
-
It utilizes the Mediapipe library for hand detection, extracting hand landmarks from the detected hands.
-
Based on the relative positions of specific landmarks (e.g., thumb and index finger), the script determines whether to perform a mouse click action using PyAutoGUI.
-
You can adjust parameters such as the hand detection confidence thresholds, frame resolution, and smoothing factor for hand movement tracking in the script (
HandTracking.py) to suit your requirements. -
Experiment with different hand gestures and conditions to fine-tune the gesture recognition and clicking actions.
This project is licensed under the MIT License - see the LICENSE file for details.
- To stop the HandTracking just click on python icon which is show in your task bar then press q for quite