83 lines
2.5 KiB
C++
83 lines
2.5 KiB
C++
#pragma once
|
|
// Public downstream contract. Owns its data; no GPU, JSON or network handles.
|
|
#include "image.hpp"
|
|
#include "lazy_gate.hpp"
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace cms {
|
|
struct DoorMaskResult {
|
|
std::string status;
|
|
int annotation_index{};
|
|
std::optional<std::string> path;
|
|
std::string format;
|
|
int area_px{};
|
|
};
|
|
struct RegionRisk {
|
|
std::string status;
|
|
std::optional<double> risk_score;
|
|
std::string risk_level;
|
|
std::string decision;
|
|
std::string source;
|
|
int track_id{};
|
|
std::string side;
|
|
std::optional<std::string> state;
|
|
// Unavailable evidence has no geometric measurements, matching the reference.
|
|
std::optional<int> region_area_px, door_overlap_px;
|
|
std::optional<double> region_overlap_ratio, min_distance_px;
|
|
std::optional<double> region_scale_px, distance_relative;
|
|
};
|
|
struct RiskResult {
|
|
std::string status;
|
|
std::optional<double> risk_score;
|
|
std::string risk_level;
|
|
std::string decision;
|
|
std::optional<std::string> source;
|
|
std::optional<int> track_id;
|
|
std::optional<std::string> side;
|
|
DoorMaskResult door_mask;
|
|
double warning_distance_relative{}, release_distance_relative{};
|
|
std::vector<RegionRisk> regions;
|
|
};
|
|
struct PosePoint { double x{},y{},score{}; };
|
|
struct HandState {
|
|
std::string state, source;
|
|
bool limb_consensus{}, distance_eligible{}, alarm_eligible{};
|
|
};
|
|
struct PersonResult {
|
|
int track_id{};
|
|
double confidence{};
|
|
std::array<double,4> box{};
|
|
std::array<PosePoint,133> selected{}, smoothed{}, temporal{};
|
|
std::array<HandState,2> hands; // left, right
|
|
};
|
|
struct HandRegion {
|
|
int person_id{},track_id{};
|
|
std::string side;
|
|
std::array<PosePoint,21> keypoints{};
|
|
};
|
|
struct StageTiming {
|
|
double detector_ms{}, pose_ms{}, fusion_risk_ms{}, capture_to_result_ms{};
|
|
};
|
|
struct FrameResult {
|
|
InferenceStatus inference;
|
|
int frame_index{};
|
|
std::vector<int> track_ids;
|
|
std::vector<std::array<double,4>> boxes;
|
|
RiskResult risk;
|
|
CaptureMetadata capture;
|
|
StageTiming timing;
|
|
std::vector<PersonResult> persons;
|
|
std::vector<HandRegion> hand_regions;
|
|
// Both images belong to this result. The constant mask is shared across frames.
|
|
std::shared_ptr<const BgrImage> image;
|
|
std::shared_ptr<const BinaryMask> door_mask_pixels;
|
|
bool door_mask_calibration_verified{};
|
|
};
|
|
using FrameResultPtr = std::shared_ptr<const FrameResult>;
|
|
}
|