mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 08:00:09 +02:00
fh-camd (camd/) borrows XRService's camera buffers and publishes the tracking cameras' frames to a shared ring. fh-tracker (trackd/) finds hands in them with MediaPipe's palm and landmark models on ncnn, triangulates them in 3D, and publishes them for ft-screens. fh-replay replays recordings offline. tracker/ is the earlier Python version; tools/ and probes/ hold the checks and experiments. As of this commit: crop contrast defaults to CLAHE for the palm search and plain crops for the landmarks, --swap-sides works around fh-camd naming the side cameras backwards after some XRService restarts (tools/check_sides.py detects it), and --record-only, --with-dark, --cpus and --keep-presence support the bright-light and CPU-placement tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
// Frames in from fh-camd's ring (camd/fhring.h), hands out to the hands file
|
|
// (include/fh_hands.h, read by Frametop's ft-screens).
|
|
#pragma once
|
|
|
|
#include "tracker.h"
|
|
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
extern "C" {
|
|
#include "../camd/fhring.h"
|
|
#include "../include/fh_hands.h"
|
|
}
|
|
|
|
class Ring {
|
|
public:
|
|
bool open(const char *path, std::string &err);
|
|
bool alive() const; // the writer's heartbeat is fresh
|
|
int cameras() const { return int(hdr_->ncams); }
|
|
const fh_ring_cam_t &camera(int i) const { return hdr_->cams[i]; }
|
|
uint64_t latest(int i) const;
|
|
// Copy frame n of camera i into out (width x height, tightly packed). False if it's
|
|
// gone or was being written.
|
|
bool read(int i, uint64_t n, std::vector<uint8_t> &out, fh_ring_slot_t *meta) const;
|
|
// Just frame n's slot header (capture time etc.), without copying the image.
|
|
bool meta(int i, uint64_t n, fh_ring_slot_t *meta) const;
|
|
|
|
private:
|
|
const uint8_t *map_ = nullptr;
|
|
const fh_ring_hdr_t *hdr_ = nullptr;
|
|
size_t len_ = 0;
|
|
};
|
|
|
|
class Publisher {
|
|
public:
|
|
bool open(std::string &err);
|
|
void write(const std::vector<const Hand *> &hands, uint64_t capture_ns);
|
|
|
|
private:
|
|
fh_hands_t *out_ = nullptr;
|
|
uint64_t seq_ = 0;
|
|
};
|
|
|
|
uint64_t mono_ns();
|
|
int64_t raw_minus_mono_ns(); // camera timestamps are CLOCK_MONOTONIC_RAW
|