101 lines
2.3 KiB
C++
101 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include <array>
|
|
#include <cstdint>
|
|
#include <string>
|
|
#include <utility>
|
|
#include <vector>
|
|
|
|
namespace fangjia {
|
|
|
|
struct Box {
|
|
float x1{};
|
|
float y1{};
|
|
float x2{};
|
|
float y2{};
|
|
float score{};
|
|
int trackId{};
|
|
};
|
|
|
|
struct Keypoint {
|
|
float x{};
|
|
float y{};
|
|
float score{};
|
|
};
|
|
|
|
struct PersonPose {
|
|
Box box;
|
|
std::array<Keypoint, 133> keypoints{};
|
|
};
|
|
|
|
enum class LimbState {
|
|
Observed,
|
|
Provisional,
|
|
Recovered,
|
|
Reassigned,
|
|
Interpolated,
|
|
PredictedShort,
|
|
ReachableMedium,
|
|
ReachableLong,
|
|
};
|
|
|
|
inline char const* limbStateName(LimbState state) {
|
|
switch (state) {
|
|
case LimbState::Observed: return "observed";
|
|
case LimbState::Provisional: return "provisional";
|
|
case LimbState::Recovered: return "recovered";
|
|
case LimbState::Reassigned: return "reassigned";
|
|
case LimbState::Interpolated: return "interpolated";
|
|
case LimbState::PredictedShort: return "predicted_short";
|
|
case LimbState::ReachableMedium: return "reachable_medium";
|
|
case LimbState::ReachableLong: return "reachable_long";
|
|
}
|
|
return "unknown";
|
|
}
|
|
|
|
struct LimbObservation {
|
|
int trackId{};
|
|
bool left{};
|
|
LimbState state{LimbState::ReachableLong};
|
|
Keypoint elbow{};
|
|
Keypoint wrist{};
|
|
std::array<Keypoint, 21> hand{};
|
|
Box personBox{};
|
|
bool handValid{};
|
|
bool alarmEligible{};
|
|
float handQuality{};
|
|
};
|
|
|
|
// Exact pre-V2 hand evidence consumed by the Python risk stage. These points
|
|
// come from raw/isolated fusion before temporal reconstruction.
|
|
struct GlobalHand {
|
|
int personId{};
|
|
int trackId{};
|
|
bool left{};
|
|
std::string source;
|
|
std::string state;
|
|
bool distanceEligible{};
|
|
bool alarmEligible{};
|
|
float score{};
|
|
float spanPx{};
|
|
std::array<Keypoint, 21> keypoints{};
|
|
std::vector<std::pair<int, bool>> aliases;
|
|
};
|
|
|
|
struct FusionMeta {
|
|
bool limbConsensus{}, handValid{}, distanceEligible{}, alarmEligible{};
|
|
double handScore{};
|
|
std::string handSource, handState;
|
|
};
|
|
|
|
struct PoseFrameResult {
|
|
std::vector<std::array<FusionMeta, 2>> metadata;
|
|
std::vector<PersonPose> selectedPeople;
|
|
std::vector<PersonPose> smoothedPeople;
|
|
std::vector<PersonPose> v2People;
|
|
std::vector<LimbObservation> limbs;
|
|
std::vector<GlobalHand> globalHands;
|
|
};
|
|
|
|
} // namespace fangjia
|