# 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`. Replace `take_screenshot` in the code with your screenshot functionality.
## Installation
1. Clone the repository or download the source code.
2. Install the required Python packages:
```bash
pip install opencv-python mediapipe
```
3. Ensure your Python environment includes the `ss_taker` library or a custom implementation for taking screenshots.
## Usage
1. Save the script to a file, e.g., `gesture_screenshot.py`.
2. Run the script:
```bash
python gesture_screenshot.py
```
3. The webcam will activate, and the program will begin detecting hand gestures.
4. Show an open palm to the camera, then transition to a fist gesture to capture a screenshot.
5. Press `q` to quit the program.
## Usage Example
```python
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
- [OpenCV](https://opencv.org/) for image processing.
- [MediaPipe](https://mediapipe.dev/) for hand landmark detection.
## To View Full Code
- [Github](https://github.com/rohitkumyadav/Gesture-Screenshot.git) to view full source code
## 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.
Raw data
{
"_id": null,
"home_page": null,
"name": "rk-screenshot",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, video, stream, video stream, camera stream, sockets",
"author": "Rohit Kumar Yadav",
"author_email": "<rohitkuyadav2003@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/34/ca/f41352af6043b462286582115b9f56c590b653111b880d4ca57a7061ca05/rk_screenshot-1.3.3.tar.gz",
"platform": null,
"description": "# Screenshot Capture Using Hand Gestures\n\nThis 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.\n\n## Features\n\n- Real-time hand gesture recognition.\n- Screenshot capture when an open palm transitions to a fist gesture.\n- Configurable and extensible for other gesture-based controls.\n\n## Requirements\n\nTo run this project, you need the following dependencies:\n\n- Python 3.7+\n- OpenCV (`cv2`)\n- MediaPipe (`mediapipe`)\n- A library or function for taking screenshots, such as `ss_taker`. Replace `take_screenshot` in the code with your screenshot functionality.\n\n## Installation\n\n1. Clone the repository or download the source code.\n2. Install the required Python packages:\n ```bash\n pip install opencv-python mediapipe\n ```\n3. Ensure your Python environment includes the `ss_taker` library or a custom implementation for taking screenshots.\n\n## Usage\n\n1. Save the script to a file, e.g., `gesture_screenshot.py`.\n2. Run the script:\n ```bash\n python gesture_screenshot.py\n ```\n3. The webcam will activate, and the program will begin detecting hand gestures.\n4. Show an open palm to the camera, then transition to a fist gesture to capture a screenshot.\n5. Press `q` to quit the program.\n\n## Usage Example\n\n```python\nfrom project_Screenshot.r_screenshot import take_screenshot , capture_screenshot\n\n# to take normal screenshot\ntake_screenshot()\n\n# for Gesture recognizer screenshot\ncapture_screenshot()\n```\n\n## How It Works\n\n### Gesture Detection\n\nThe script uses the MediaPipe library to detect hand landmarks and determine whether the hand is open or closed:\n- **Open palm:** All fingers extended (based on landmark positions).\n- **Fist:** All fingers closed.\n\n### Screenshot Trigger\n\nWhen the script detects a transition from an open palm to a fist, it calls the `take_screenshot()` function to capture the current screen.\n\n### Core Functions\n#### `is_palm_open(landmarks)`\nDetermines whether the hand is open by comparing the positions of finger landmarks.\n\n#### `capture_screenshot()`\nMain function that:\n- Captures video from the webcam.\n- Processes each frame for hand landmarks.\n- Detects gesture transitions and triggers screenshot capture.\n\n## Customization\nYou can modify the script to:\n- Recognize additional gestures.\n- Perform other actions (e.g., send alerts or control devices) based on gestures.\n\n## Limitations\n- Requires a clear view of the hand for accurate detection.\n- Designed for a single hand; might need enhancements for multi-hand detection.\n\n## Acknowledgments\n- [OpenCV](https://opencv.org/) for image processing.\n- [MediaPipe](https://mediapipe.dev/) for hand landmark detection.\n\n## To View Full Code\n- [Github](https://github.com/rohitkumyadav/Gesture-Screenshot.git) to view full source code\n\n## Contributing\nContributions are welcome! If you have ideas for improvements or additional features, feel free to submit a pull request or open an issue.\n\n## License\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Screenshot using Gesture hand detection",
"version": "1.3.3",
"project_urls": null,
"split_keywords": [
"python",
" video",
" stream",
" video stream",
" camera stream",
" sockets"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "299ef8f8e2f2fece5d3e070cd098bcb1cf46bd5e9bfee0d92419920172326ec1",
"md5": "e2048c4088393f0ba27e6c91dba445ff",
"sha256": "94d98e31fffcf42c3e002a0bce2ba1e74ed59091b7623653d0c1ba7dd9bb7542"
},
"downloads": -1,
"filename": "rk_screenshot-1.3.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e2048c4088393f0ba27e6c91dba445ff",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 5323,
"upload_time": "2024-12-21T17:37:05",
"upload_time_iso_8601": "2024-12-21T17:37:05.947482Z",
"url": "https://files.pythonhosted.org/packages/29/9e/f8f8e2f2fece5d3e070cd098bcb1cf46bd5e9bfee0d92419920172326ec1/rk_screenshot-1.3.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "34caf41352af6043b462286582115b9f56c590b653111b880d4ca57a7061ca05",
"md5": "6ddd2154c31d6fee5ff98f6689372754",
"sha256": "ec9102c757d7d2dbcae58b9d997b9e2b9c3dc68848b9a709f475de79e2cfdc79"
},
"downloads": -1,
"filename": "rk_screenshot-1.3.3.tar.gz",
"has_sig": false,
"md5_digest": "6ddd2154c31d6fee5ff98f6689372754",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 5118,
"upload_time": "2024-12-21T17:37:07",
"upload_time_iso_8601": "2024-12-21T17:37:07.572201Z",
"url": "https://files.pythonhosted.org/packages/34/ca/f41352af6043b462286582115b9f56c590b653111b880d4ca57a7061ca05/rk_screenshot-1.3.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-21 17:37:07",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "rk-screenshot"
}