65 lines
1.7 KiB
C++
65 lines
1.7 KiB
C++
#ifndef NUI_CORE_CALIBRATION_H
|
|
#define NUI_CORE_CALIBRATION_H
|
|
|
|
#include <array>
|
|
#include <string>
|
|
|
|
#include "mapping/mapping.h"
|
|
|
|
namespace nui::calibration {
|
|
|
|
struct TposeObservation {
|
|
bool person_detected = false;
|
|
float root_depth_meters = 2.5f;
|
|
float normalized_shoulder_width = 0.0f;
|
|
std::array<float, 4> floor_plane{0.0f, 1.0f, 0.0f, 0.0f};
|
|
bool mirror = true;
|
|
};
|
|
|
|
struct RaiseRightArmObservation {
|
|
bool person_detected = false;
|
|
float right_shoulder_u = 0.0f;
|
|
float right_wrist_u = 0.0f;
|
|
float right_shoulder_v = 0.0f;
|
|
float right_wrist_v = 0.0f;
|
|
float left_shoulder_v = 0.0f;
|
|
float left_wrist_v = 0.0f;
|
|
};
|
|
|
|
struct CalibrationConfig {
|
|
mapping::MappingConfig mapping{};
|
|
mapping::SmoothingParameters smoothing{};
|
|
float player_scale = 1.0f;
|
|
std::array<float, 4> floor_plane{0.0f, 1.0f, 0.0f, 0.0f};
|
|
};
|
|
|
|
constexpr float kTargetShoulderWidthMeters = 0.40f;
|
|
|
|
// Mirror-confirm step: the subject raises only the anatomical right arm. A
|
|
// raw camera image places that arm on image-left, requiring the global mirror.
|
|
bool confirm_mirror_raise_right_arm(
|
|
const RaiseRightArmObservation& observation,
|
|
bool& mirror,
|
|
std::string& error);
|
|
|
|
// Produces the one-time T-pose calibration. The shoulder span establishes the
|
|
// player-space scale and Z0 preserves the observed root placement.
|
|
bool calibrate_tpose(
|
|
const TposeObservation& observation,
|
|
CalibrationConfig& output,
|
|
std::string& error);
|
|
|
|
bool save_config(
|
|
const CalibrationConfig& config,
|
|
const std::string& path,
|
|
std::string& error);
|
|
|
|
bool load_config(
|
|
const std::string& path,
|
|
CalibrationConfig& output,
|
|
std::string& error);
|
|
|
|
} // namespace nui::calibration
|
|
|
|
#endif // NUI_CORE_CALIBRATION_H
|