Skip to main content

real-time hands tracker, sends joints coords over OSC

Project description

handjoints-osc

Real-time hand tracking that sends joint coordinates over OSC. Written in Python, using Google MediaPipe.

Installation

Installing via pipx is recommended, because it installs in an isolated environment.

pipx install handjoints-osc

It's of course also possible to install via pip:

pip install handjoints-osc

Usage

$ handjoints-osc --help

usage: handjoints-osc [-h] [--host HOST] [--confidence CONFIDENCE] port

positional arguments: port send OSC to this port

options: -h, --help show this help message and exit --host HOST send OSC to this host (default: localhost) --confidence CONFIDENCE, -c CONFIDENCE minimum detection confidence threshold (default: 0.5) --device DEVICE, -d DEVICE video device index or path (default: 0, i.e. the default video device) --invert, -i invert colors

For example, to start the program and send joints coordinates to SuperCollider, which typically listens for OSC on port 57120:

handjoints-osc 57120

When hands are detected, SuperCollider will start receiving OSC messages with path "/handjoints-osc". To know which value corresponds to which joint, pressing "n" will display joint numbers on the tracking window.

Example using an alternative video device:

handjoints-osc -d /dev/video2 57120

Keybindings

  • press n to toggle joint numbers
  • press i to invert colors (light theme)

OSC format

  • path: /handjoints i *i* ...f
  • [0] number of detected hands
  • [1:numHands] handedness for each detected hand
  • [numHands+1:..] x and y coordinates for each joint for each hand

The program detects maximum 2 hands, each hand has 21 joints, and each joint 2 coordinates.

Arguments are all in a single list, starting with the number of hands, then handedness for each hand, and following with x and y coordinates for all joints of one hand, and then the joint of each other hand.

[nHands, ...handedness, ...coordsHand0, ...cordsHand1] coords: [j0x, j0y, j1x, j1y, j2x, j2y, ...]

If only one hand is detected, numHands + handedness + coords (21 * 2) gives 44 values. If two hands are detected, there are two handedness values, so 1 + 2 + 42 + 42 = 87 values.

Development

Recommended: make a virtual environment

python -m venv .venv source .venv/bin/activate

Install requirements:

pip install -r requirements

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

handjoints_osc-0.0.8.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

handjoints_osc-0.0.8-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

Details for the file handjoints_osc-0.0.8.tar.gz.

File metadata

  • Download URL: handjoints_osc-0.0.8.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for handjoints_osc-0.0.8.tar.gz
Algorithm Hash digest
SHA256 5c2c4000ac34dac599d49156dff4c3038cca32a16ac7a815bac4b68d22eb475b
MD5 f27ca7c6c816279c1cdbbb4f4ca9867e
BLAKE2b-256 9938d610cba3dee118aad40173e5e220fe34a8aa8ab5c0cf4a9b72c07c2045cf

See more details on using hashes here.

File details

Details for the file handjoints_osc-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: handjoints_osc-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 6.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for handjoints_osc-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 46335ab0207b7ba0fef7906428f1207e70cd2464cbcfd2198f8284c0f9273ddb
MD5 d6a5213c8223d0e02f79de0cd7a27cbb
BLAKE2b-256 9db31ca9fee17a81be21ac2c7e3f49d14c2da40734172cac0917487cb3095348

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