Skip to main content

A package for hand recognition using MediaPipe and OpenCV

Project description

MediaPipe Hand Tracking Utility

A simple Python utility to perform hand landmark detection on static images and live webcam streams using Google's MediaPipe.

This package provides two simple functions, process_static_images and run_webcam_detection, that wrap the MediaPipe Hands solution for easy use. It is based on the official MediaPipe Hands example.

Features

Webcam Detection: Run real-time hand tracking on your default webcam feed with a single function call.

Static Image Processing: Process one or more static images, detect all hands, and save annotated copies to a specified directory.

3D Landmark Plotting: Optionally plots 3D world landmarks for each detected hand (requires matplotlib).

Installation

You can install this package directly from PyPI:

pip install your-package-name

This will also install all necessary dependencies.

Requirements

This package requires the following Python libraries:

opencv-python

mediapipe

matplotlib (for 3D landmark plotting)

Usage

Once installed, you can import the utility functions into your own Python scripts.

Example 1: Run Webcam Detection

This will open your default webcam (index 0) and start real-time hand detection. The annotated video stream will be displayed in an OpenCV window.

Press the 'ESC' key to quit.

Import the package (assuming your file is named 'hand_tracker.py' inside the package)

from your_package_name import hand_tracker

Run the webcam detection

hand_tracker.run_webcam_detection(camera_index=0)

Example 2: Process Static Images

This function will process a list of image files, draw hand landmarks on them, and save the new annotated images to an output directory.

from your_package_name import hand_tracker

Create a list of image paths you want to process

image_list = [ '/path/to/your/image1.jpg', '/path/to/your/image2.png' ]

Specify an output directory

output_folder = "annotated_hand_images"

Process the images

hand_tracker.process_static_images(image_list, output_dir=output_folder)

print(f"Processed images saved to '{output_folder}'")

This will create a folder named annotated_hand_images in your current directory and save files like annotated_image_0.png and annotated_image_1.png inside it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hand_recog-0.1.1.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hand_recog-0.1.1-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file hand_recog-0.1.1.tar.gz.

File metadata

  • Download URL: hand_recog-0.1.1.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for hand_recog-0.1.1.tar.gz
Algorithm Hash digest
SHA256 883383d4258482a811b9929b1e26634d378d4954c92bda620c3e290a9d4cf1d3
MD5 309d9d4a9d78f750b1669c1ba9b4d65d
BLAKE2b-256 b649306398b4afaa4b6f51aaff06438b626c5ed28d41fba631cf776fa1580668

See more details on using hashes here.

File details

Details for the file hand_recog-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: hand_recog-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for hand_recog-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b02a9fc6113f5aab0dfb3d6b58f8c7d9f1aa82182119e57ad5143ddb9e371d33
MD5 4e87ffa87a93416989e0af57723fff3a
BLAKE2b-256 a49edf7c2796dc3a7cf7ce989bf7fc09fe6dbd26aa4bbb5e63a9ffd495b99a89

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page