This project allows you to scroll a webpage up and down by detecting the vertical movement of your index finger using your webcam. It utilizes MediaPipe for hand tracking and pyautogui for simulating scroll events.
# { height =200px width=250px}
- Python 3.x
- OpenCV
- MediaPipe
- PyAutoGUI
- NumPy
-
Clone the repository:
git clone <repository_url> cd <repository_directory>
-
Create and activate a virtual environment (optional but recommended):
python -m venv venv source venv/bin/activate # On Windows, use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Run the script:
python hand_gesture_scroll.py
-
The script will open a window displaying the video feed from your webcam. Move your index finger up or down in front of the camera to scroll the page.
-
Press the 'q' key to quit the application.
- The script captures video frames from your webcam and processes them using MediaPipe's hand tracking solution.
- It detects the position of the index finger and calculates the vertical movement.
- If the movement exceeds a threshold and the cooldown period has passed, it simulates a scroll event using pyautogui.
- A 3-second cooldown period is implemented to allow the finger to return to a neutral position after scrolling.
- Ensure that your webcam is properly connected and working.
- Make sure you have installed all the required packages.
- Adjust the sensitivity and thresholds if the scrolling is too sensitive or not responsive enough.
If you have any suggestions or improvements, feel free to create a pull request or open an issue.
This project is licensed under the MIT License.