mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 07:00:14 +02:00
The history of frame-hands (~/Desktop/Projects/frame-hands on the Frame), filtered to what moves: the camera broker (camd/), the tracker and its offline tools (trackd/), the shared file layouts (include/), the ncnn models, the analysis tools, and the calibration and model helpers they import from the Python prototype. The reverse-engineering notes, probes, camprobe, and the rest of the prototype stay in frame-hands. Unchanged here: the renames to ft- names and Frametop paths follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
59 lines
2.4 KiB
C
59 lines
2.4 KiB
C
/*
|
|
* fh_hands - the tracked-hands file frame-hands' tracker publishes
|
|
* ($XDG_RUNTIME_DIR/frame-hands/hands, directory mode 0700), rewritten in place
|
|
* under a sequence lock: read seq, copy, read seq again; use the copy only if
|
|
* both reads are the same even number.
|
|
*
|
|
* Positions are metres in the head frame at capture time, which is OpenVR's HMD
|
|
* frame (+x right, +y up, -z forward). Turn them into the room with the HMD pose
|
|
* at capture_ns (CLOCK_MONOTONIC). Writers: trackd (fh-tracker), tracker/publish.py.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <assert.h>
|
|
#include <stdint.h>
|
|
|
|
#define FH_HANDS_MAGIC "FHHANDS1"
|
|
#define FH_HANDS_VERSION 1
|
|
#define FH_HANDS_MAX_HANDS 2
|
|
#define FH_HANDS_MAX_CAPSULES 64
|
|
|
|
enum {
|
|
FH_HAND_RIGHT = 1u << 0, /* else the left hand */
|
|
FH_HAND_STEREO = 1u << 1, /* triangulated from two or more cameras */
|
|
};
|
|
|
|
typedef struct {
|
|
uint32_t id; /* stays the same while the hand is tracked */
|
|
uint32_t flags; /* FH_HAND_* */
|
|
float confidence;
|
|
float reserved;
|
|
float pts[21][3]; /* MediaPipe hand landmarks */
|
|
uint32_t ncapsules; /* this hand's capsules, which follow the */
|
|
/* previous hands' in capsules[] */
|
|
} fh_hand_t; /* 272 bytes */
|
|
|
|
typedef struct {
|
|
float a[3], b[3]; /* segment ends */
|
|
float ra, rb; /* radius at each end */
|
|
} fh_capsule_t; /* 32 bytes: the hand's shape, to cut out */
|
|
|
|
typedef struct {
|
|
char magic[8];
|
|
uint32_t version;
|
|
uint32_t size;
|
|
volatile uint64_t seq;
|
|
uint64_t capture_ns; /* CLOCK_MONOTONIC when the cameras took the frames */
|
|
uint64_t publish_ns; /* CLOCK_MONOTONIC when this was written */
|
|
uint32_t nhands;
|
|
uint32_t ncapsules;
|
|
uint8_t reserved[16];
|
|
fh_hand_t hands[FH_HANDS_MAX_HANDS];
|
|
fh_capsule_t capsules[FH_HANDS_MAX_CAPSULES];
|
|
} fh_hands_t;
|
|
|
|
static_assert(sizeof(fh_hand_t) == 272, "fh_hand_t layout");
|
|
static_assert(sizeof(fh_capsule_t) == 32, "fh_capsule_t layout");
|
|
static_assert(sizeof(fh_hands_t) == 64 + 2 * 272 + 64 * 32, "fh_hands_t layout");
|