Python wrapper around Google Mediapipe's Hand Landmark Detection that organizes raw landmark data into usable hand objects with per-finger access, angle calculation, raised finger detection, and more.
Project description
Hand Tracking
Python wrapper around Google Mediapipe's Hand Landmark Detection that organizes raw landmark data into usable hand objects with per-finger access, angle calculation, raised finger detection, and more.
Installation
Install from PyPI:
pip install handy-hand-tracking
If you want to work from a local checkout instead, you can install it in editable mode:
git clone https://github.com/DwnNyxDev/hand_tracking.git
cd hand_tracking
python -m pip install -e .
The bundled hand_landmarker.task model file is included with the package, so no separate download is needed.
Usage
A simple example entry point is available after installation that reads in video from your device:
hand-tracking-example
You can also run the module directly:
python -m hand_tracking.example
Example import usage:
from hand_tracking.landmark_detector import LiveLandmarkDetector
API Reference
Hand
Represents a single detected hand with landmark positions and gesture utilities.
from hand_tracking.hands import Hand
Attributes:
side(str):"Left"or"Right".wrist(tuple):(x, y, z)normalized coordinates of the wrist landmark.fingers(dict): Maps finger names to arrays of 4 landmark points each. Keys:"thumb","index","middle","ring","pinky".
Methods:
get_raised_fingers() → list[str] — Returns the names of fingers that are currently extended (not bent).
raised = hand.get_raised_fingers()
# e.g. ["index", "middle"]
calculate_finger_angle(finger_name) → float — Returns the angle (in radians) of the given finger relative to the image axes.
angle = hand.calculate_finger_angle("index")
Usage in a ROS2 / Docker Workspace
Add to your Dockerfile:
RUN pip install handy-hand-tracking
Then in your ROS2 node:
from hand_tracking.landmark_detector import LiveLandmarkDetector
from hand_tracking.hands import Hand
Troubleshooting: Webcam Not Available (Windows/WSL)
If docker compose up fails with:
Error response from daemon: error gathering device information while adding custom device "/dev/video0": no such file or directory
You're likely on Windows with WSL2. USB devices aren't available to WSL by default — you need to attach your webcam manually using usbipd.
Open PowerShell as Administrator and run:
usbipd list
Find your webcam in the list and note its bus ID (e.g. 2-3).
First time only — bind the device:
usbipd bind --busid 2-3
Every restart — attach it to WSL:
usbipd attach --wsl --busid 2-3
Binding is a one-time step that persists. Attaching is lost on every Windows restart and must be re-run each session before starting Docker. Then try docker compose up again. If usbipd is not installed, get it from usbipd-win.
Dependencies
mediapipenumpyopencv-python
Used In
- hand_controller — ROS 2 package that wraps this library into a node for robot control pipelines
License
MIT
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 handy_hand_tracking-1.0.1.tar.gz.
File metadata
- Download URL: handy_hand_tracking-1.0.1.tar.gz
- Upload date:
- Size: 5.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b51ff6e7cb46b230962458f2e7bc189ad20ccdf74fae7cd77c37dcb9c7f413e
|
|
| MD5 |
aa260de6d2c50df9131a73b2945cad1c
|
|
| BLAKE2b-256 |
a03cd229995cce173076dbf92fa157fcaa3a9b61df0bbb5a1987f90c28f72002
|
File details
Details for the file handy_hand_tracking-1.0.1-py3-none-any.whl.
File metadata
- Download URL: handy_hand_tracking-1.0.1-py3-none-any.whl
- Upload date:
- Size: 5.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c90dd0c26281cefd54bf85bb88b8429162c13801f315eecccfa2c5a33fafc3f2
|
|
| MD5 |
d79eaea5c979d38e918c045ddc0d6591
|
|
| BLAKE2b-256 |
7573c8f246307ebc7d3bcd575c18035fdcb36bab095e0def1df11a5a51962192
|