Files
kinect/core/synth/synth.h
T
kinect-bot 3fef71b020
ci / Linux C++ core (cmake + ctest) (push) Canceled after 0s
ci / Python tracker (pytest) (push) Canceled after 0s
feat(synth): articulated depth + player-index + color/IR rasterizer (wave 4; todo 7 done)
2026-11-25 04:33:33 -05:00

67 lines
1.3 KiB
C++

#ifndef NUI_CORE_SYNTH_H
#define NUI_CORE_SYNTH_H
#include <cstddef>
#include <cstdint>
#include <vector>
#include "contract/contract.h"
#include "synth/mask_stabilizer.h"
namespace nui::synth {
struct DepthRasterRequest {
ImageSize size;
uint8_t skeleton_slot;
};
struct DepthFrame {
ImageSize size;
uint32_t pitch;
std::vector<uint16_t> pixels;
};
struct BgraFrame {
ImageSize size;
uint32_t pitch;
std::vector<uint8_t> pixels;
};
struct InfraredFrame {
ImageSize size;
uint32_t pitch;
std::vector<uint16_t> pixels;
};
uint16_t pack_depth(uint16_t depth_mm, uint8_t player_index);
uint16_t NuiDepthPixelToDepth(uint16_t packed_depth);
uint8_t NuiDepthPixelToPlayerIndex(uint16_t packed_depth);
class DepthRasterizer {
public:
explicit DepthRasterizer(std::size_t temporal_hold_frames = 2);
DepthFrame rasterize(
const SegmentationMask& mask,
const contract::SkeletonFrame& skeleton,
DepthRasterRequest request);
const BinaryMask& stable_mask() const;
private:
MaskStabilizer stabilizer_;
BinaryMask stable_mask_{};
};
BgraFrame passthrough_color(
const BgraFrame& source,
ImageSize requested_size);
InfraredFrame synthesize_infrared(
const BgraFrame& source,
ImageSize requested_size);
} // namespace nui::synth
#endif // NUI_CORE_SYNTH_H