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
Metadata
Release files for handy-hand-tracking 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| handy_hand_tracking-1.0.1.tar.gz | 5.8 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| handy_hand_tracking-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.7 MB
Release files / handy_hand_tracking-1.0.1.tar.gz
| Download URL | handy_hand_tracking-1.0.1.tar.gz |
|---|---|
| Size | 5.8 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9b51ff6e7cb46b230962458f2e7bc189ad20ccdf74fae7cd77c37dcb9c7f413e
|
|
BLAKE2b-256 checksum How to use checksums |
a03cd229995cce173076dbf92fa157fcaa3a9b61df0bbb5a1987f90c28f72002
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / handy_hand_tracking-1.0.1-py3-none-any.whl
| Download URL | handy_hand_tracking-1.0.1-py3-none-any.whl |
|---|---|
| Size | 5.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c90dd0c26281cefd54bf85bb88b8429162c13801f315eecccfa2c5a33fafc3f2
|
|
BLAKE2b-256 checksum How to use checksums |
7573c8f246307ebc7d3bcd575c18035fdcb36bab095e0def1df11a5a51962192
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|