frametop

Hand tracking: the skeleton, pinches and flags

These sections were split out of README.md to keep it readable.

Skeleton

After the 3D step, ft-hands fits a skeleton with your own bone lengths to each hand (track/skeleton.h), so fingers keep their length and don’t wobble. It’s the base for a hand mesh, colliders and the hand ray. --skeleton 0 (HANDS_SKELETON=0) turns it off.

What it measured, ft-handreplay on three recordings and three takes of the 2026-10-03 hand-recorder session (frame-hands notes/skeleton-fit.md has every number):

2026-09-29/30 recordings, 30 Hz dim (typing) lit bright
Bone length spread per track (median CV): measured / One Euro / skeleton 0.41 / 0.37 / 0.05 0.24 / 0.22 / 0.03 0.39 / 0.35 / 0.01
Index tip jitter, hand and fingers still, mm (median; 90%): One Euro / skeleton 4.5 / 3.9; 16.9 / 24.3 3.4 / 2.8; 11.0 / 14.7 4.2 / 3.2; 11.5 / 10.2
Thumb tip jitter, still, mm (median; 90%) 3.0 / 2.7; 12.0 / 11.8 2.4 / 2.7; 7.8 / 12.0 3.0 / 2.2; 10.1 / 8.7
Index tip jitter, palm over 0.3 m/s, median mm 14.0 / 11.2 11.0 / 8.6 17.7 / 14.7
Palm jitter, still, median mm 1.8 / 1.8 1.9 / 1.8 1.9 / 1.8
Tips trailing, moving over 0.5 m/s, median mm 6.5 / 5.7 5.1 / 4.9 5.7 / 4.9
Tips trailing, fingers moving on the palm, median mm 7.8 / 3.5 5.9 / 4.7 4.6 / 3.5
Palm normal’s turn per update, palm still, fingers moving, median degrees 2.8 / 1.7 2.2 / 1.3 2.3 / 2.0
Fit rms against the measured landmarks, stereo, median mm 10.4 9.0 7.6
Calibration settled after each side’s first sample, s (left, right) 20.5, 10.9 10.8, 3.5 15.6, 8.9

Pinch

ft-hands detects a pinch per hand (track/pinch.h) and publishes it to the gestures file. The layout, and how to read it without missing quick taps, is in include/fh_gestures.h.

Pinches and grips in the pointer

With POINTER_HANDS=1, the pointer helper (pointer/helper/ft-pointer.cpp) reads the gestures file every frame. It’s off by default.

The hand ray (POINTER_HAND_RAY=1, the default with POINTER_HANDS): a bare hand in front and pointing, palm away, high or low, out in front or lowered toward you (not while it types: the typing guard; POINTER_RAY_RAISED=30 brings back the old height limit, the knuckles within 30 cm under the eyes, and POINTER_RAY_FORWARD=25 the old reach limit, at least 25 cm in front of them), shows a ray from it, Quest-style (include/fh_ray.h: from a shoulder estimated from the head, through the knuckles), and the ray drives the pointer’s virtual controller, so it works on SteamVR’s dashboard, Steam’s pages, overlays and Frametop’s panels like a controller’s laser. The ray comes up as the thumb nears the index or middle tip (POINTER_RAY_READY). With the ray up, a pinch clicks (a held pinch drags), a middle pinch right-clicks (held and moved, it scrolls), a three-finger pinch (thumb, index and middle together) scrolls as the hand moves, and while a pinch carries a panel, reaching out pushes it away and pulling in brings it near. With the hand low or the palm toward you, there’s no ray, and pinches and grips work as below. In gaze mode there’s no ray at all unless POINTER_GAZE_HAND_RAY=1. A hand holding a controller, or whose controller was used in the last seconds, has no ray and no gestures (the helper’s handoff, pointer/helper/handoff.h). The rules, timings and measurements are at the top of ft-pointer.cpp (“Handoff”, “Hand ray”) and in frame-hands’ notes/hand-interaction.md. pointer/tools/rayeval runs the ray over a replay (ft-handreplay --ray).

Settings in ~/.config/frametop.conf:

Flags

When tracking goes wrong in real use, flag it: ft-handsctl flag [note], or by voice with frame-voice’s voice commands (its commands setting: “flag that” runs ft-handsctl flag with the words after it as the note, e.g. “flag that, fingers crossed”). The offline tools (frame-hands’ train/flags) relabel what was saved with the teacher, find what went wrong and in which situations, and make guided capture sessions for the weakest ones.

ft-hands keeps a rolling buffer in RAM (track/flagbuf.h, HANDS_FLAG_BUFFER=1): per processed set, a mono crop around each view the tracker used (its landmark crop’s centre, 1.6 times its size, axis aligned, at most HANDS_FLAG_CROP px a side), with where it is in the image, so labels made on it lift back to the image and triangulate; a lost view is still cropped where it was for a second, so the teacher can say whether the hand was there; and its hands, gestures and each view’s landmarks. It keeps HANDS_FLAG_SECONDS and at most HANDS_FLAG_MB of crops; nothing is written until a flag. Cost, measured (2026-10-09, a replayed ring with two hands in view): about 80 crops a second at 20 sets a second, 56 MB of crops for 14 s at 224 px (ft-hands’ peak RSS 101 -> 159 MB), and 0.1 ms a crop on a tracking core (A720), so about 1% of a core; ft-hands’ CPU time was the same with and without it. At 30 sets a second with four views the 80 MB cap can trim the oldest seconds.

ft-handsctl flag makes HANDS_FLAG_DIR/flag-<time>/ and asks ft-hands for the buffer through run_dir/flag; ft-hands keeps going for 2 s more, then a thread of its own (off the tracking cores, lowest priority) writes manifest.json (written last), sets.jsonl, crops.jsonl and crops.bin. Once ft-hands has taken the request, the drawn hands pulse cyan for half a second (ft-handview’s flash; HANDS_FLAG_FLASH=0 turns it off; HANDS_FLAG_TONE=1 also plays a short tone). It returns then, and in the background saves one frame of your view from /dev/video99 as view.jpg (HANDS_FLAG_VIEW=0 skips it), the head’s poses over the window from ft-handview (poses) as hmd.jsonl, and ctl.json. ft-hands logs each flag (“flag:”, “flag written:”), and the status line has the buffer’s size and cost. A flag while one is being taken adds its note to it. The format is in frame-hands’ notes/flag-failures.md. The crops show your hands and some of the room: keep flags with your recordings.

ft-handreplay REC --flag-at S1,S2 --flag-out DIR (or --flag-every S) makes the same flags from a recording, with the same buffer, for testing the offline tools before real flags exist; --flag-crop PX, --flag-scale F, --flag-mb MB and --flag-seconds S change the buffer.