Screenshot using Gesture hand detection
Project description
Screenshot Capture Using Hand Gestures
This project enables users to take screenshots using hand gestures detected via a webcam. It leverages the MediaPipe library for hand detection and OpenCV for video processing. The logic uses the transition of hand gestures (from an open palm to a fist) to trigger a screenshot.
Features
- Real-time hand gesture recognition.
- Screenshot capture when an open palm transitions to a fist gesture.
- Configurable and extensible for other gesture-based controls.
Requirements
To run this project, you need the following dependencies:
- Python 3.7+
- OpenCV (
cv2) - MediaPipe (
mediapipe) - A library or function for taking screenshots, such as
ss_taker. Replacetake_screenshotin the code with your screenshot functionality.
Installation
- Clone the repository or download the source code.
- Install the required Python packages:
pip install opencv-python mediapipe
- Ensure your Python environment includes the
ss_takerlibrary or a custom implementation for taking screenshots.
Usage
- Save the script to a file, e.g.,
gesture_screenshot.py. - Run the script:
python gesture_screenshot.py - The webcam will activate, and the program will begin detecting hand gestures.
- Show an open palm to the camera, then transition to a fist gesture to capture a screenshot.
- Press
qto quit the program.
Usage Example
from project_Screenshot.r_screenshot import take_screenshot , capture_screenshot
# to take normal screenshot
take_screenshot()
# for Gesture recognizer screenshot
capture_screenshot()
How It Works
Gesture Detection
The script uses the MediaPipe library to detect hand landmarks and determine whether the hand is open or closed:
- Open palm: All fingers extended (based on landmark positions).
- Fist: All fingers closed.
Screenshot Trigger
When the script detects a transition from an open palm to a fist, it calls the take_screenshot() function to capture the current screen.
Core Functions
is_palm_open(landmarks)
Determines whether the hand is open by comparing the positions of finger landmarks.
capture_screenshot()
Main function that:
- Captures video from the webcam.
- Processes each frame for hand landmarks.
- Detects gesture transitions and triggers screenshot capture.
Customization
You can modify the script to:
- Recognize additional gestures.
- Perform other actions (e.g., send alerts or control devices) based on gestures.
Limitations
- Requires a clear view of the hand for accurate detection.
- Designed for a single hand; might need enhancements for multi-hand detection.
Acknowledgments
Contributing
Contributions are welcome! If you have ideas for improvements or additional features, feel free to submit a pull request or open an issue.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rk_screenshot-1.2.5.tar.gz.
File metadata
- Download URL: rk_screenshot-1.2.5.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
25cd47ee795ccd9249bf5aff9ce5d45c2fea88b28cd01c71463d544b10f352ec
|
|
| MD5 |
76f7d895358b6040df3eca22330e7f10
|
|
| BLAKE2b-256 |
dde6333a398fe80ea79b921a9a919974e75014c10282744af35cb24587ccff08
|
File details
Details for the file rk_screenshot-1.2.5-py3-none-any.whl.
File metadata
- Download URL: rk_screenshot-1.2.5-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
85f996f7c4c6eed4d3ff379248d160b5d075eb673791132aeea86b5cb71b3107
|
|
| MD5 |
405ee4ba2e94805d10e2ab70e978b552
|
|
| BLAKE2b-256 |
822c5871c48b0036b41fae33ad119dbb5cadd2713cccf2cd76d6e7356f7fa667
|