Skip to main content

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:
    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:
    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

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

To View Full Code

  • Github 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.

Metadata

Release files for rk-screenshot 1.3.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rk-screenshot 1.3.3
File Size Uploaded
rk_screenshot-1.3.3.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rk-screenshot 1.3.3
File Interpreter ABI Platform
rk_screenshot-1.3.3-py3-none-any.whl Python 3 none any Details

Total release size: 10.4 kB

Release files / rk_screenshot-1.3.3.tar.gz

Download URL rk_screenshot-1.3.3.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ec9102c757d7d2dbcae58b9d997b9e2b9c3dc68848b9a709f475de79e2cfdc79
BLAKE2b-256 checksum
How to use checksums
34caf41352af6043b462286582115b9f56c590b653111b880d4ca57a7061ca05
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release files / rk_screenshot-1.3.3-py3-none-any.whl

Download URL rk_screenshot-1.3.3-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94d98e31fffcf42c3e002a0bce2ba1e74ed59091b7623653d0c1ba7dd9bb7542
BLAKE2b-256 checksum
How to use checksums
299ef8f8e2f2fece5d3e070cd098bcb1cf46bd5e9bfee0d92419920172326ec1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.12.7

Release history Release notifications | RSS feed

This release

1.3.3 This release

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.9

2 release files

1.2.8

2 release files

1.2.7

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.1

2 release files

1.2.0

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page