Monado OpenXR Runtime
hg_model.cpp File Reference

Mercury ML models! More...

#include "hg_sync.hpp"
#include "hg_image_math.inl"
#include "hg_numerics_checker.hpp"
#include <filesystem>
#include <array>
Include dependency graph for hg_model.cpp:

Macros

#define ORT(expr)
 

Functions

static cv::Matx23f xrt::tracking::hand::mercury::blackbar (const cv::Mat &in, enum t_camera_orientation rot, cv::Mat &out, xrt_size out_size)
 
static int xrt::tracking::hand::mercury::argmax (const float *data, int size)
 
static bool xrt::tracking::hand::mercury::hand_depth_center_of_mass (struct HandTracking *hgt, float data[22], float *out_depth, float *out_confidence)
 
static bool xrt::tracking::hand::mercury::refine_center_of_distribution (struct HandTracking *hgt, const float *data, int coarse_x, int coarse_y, int w, int h, float *out_refined_x, float *out_refined_y)
 
static bool xrt::tracking::hand::mercury::normalizeGrayscaleImage (cv::Mat &data_in, cv::Mat &data_out)
 
void xrt::tracking::hand::mercury::setup_ort_api (HandTracking *hgt, onnx_wrap *wrap, std::filesystem::path path)
 
void xrt::tracking::hand::mercury::setup_model_image_input (HandTracking *hgt, onnx_wrap *wrap, const char *name, int64_t w, int64_t h)
 
void xrt::tracking::hand::mercury::init_hand_detection (HandTracking *hgt, onnx_wrap *wrap)
 
void xrt::tracking::hand::mercury::run_hand_detection (void *ptr)
 
void xrt::tracking::hand::mercury::init_keypoint_estimation (HandTracking *hgt, onnx_wrap *wrap)
 
void xrt::tracking::hand::mercury::make_keypoint_heatmap_output (int camera_idx, int hand_idx, int grid_pt_x, int grid_pt_y, float *plane, cv::Mat &out)
 
void xrt::tracking::hand::mercury::make_keypoint_depth_heatmap_output (int camera_idx, int hand_idx, int grid_pt_x, int grid_pt_y, float *plane, cv::Mat &out)
 
void xrt::tracking::hand::mercury::set_predicted_zero (float *data)
 
void xrt::tracking::hand::mercury::run_keypoint_estimation (void *ptr)
 
void xrt::tracking::hand::mercury::release_onnx_wrap (onnx_wrap *wrap)
 

Variables

enum xrt_hand_joint xrt::tracking::hand::mercury::joints_ml_to_xr [21]
 

Detailed Description

Mercury ML models!

Author
Moses Turner moses.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m

Macro Definition Documentation

◆ ORT

#define ORT (   expr)
Value:
do { \
OrtStatus *status = wrap->api->expr; \
if (status != nullptr) { \
const char *msg = wrap->api->GetErrorMessage(status); \
HG_ERROR(hgt, "[%s:%d]: %s\n", __FILE__, __LINE__, msg); \
wrap->api->ReleaseStatus(status); \
assert(false); \
} \
} while (0)

Function Documentation

◆ normalizeGrayscaleImage()

static bool xrt::tracking::hand::mercury::normalizeGrayscaleImage ( cv::Mat &  data_in,
cv::Mat &  data_out 
)
static

◆ refine_center_of_distribution()

static bool xrt::tracking::hand::mercury::refine_center_of_distribution ( struct HandTracking hgt,
const float *  data,
int  coarse_x,
int  coarse_y,
int  w,
int  h,
float *  out_refined_x,
float *  out_refined_y 
)
static
Todo:
this is not good and has at least one edge case, make it more readable and link to a jupyter notebook

References xrt::tracking::hand::mercury::refine_center_of_distribution().

Referenced by xrt::tracking::hand::mercury::refine_center_of_distribution().

◆ run_keypoint_estimation()

void xrt::tracking::hand::mercury::run_keypoint_estimation ( void *  ptr)

Variable Documentation

◆ joints_ml_to_xr

enum xrt_hand_joint xrt::tracking::hand::mercury::joints_ml_to_xr[21]
Initial value:
{
XRT_HAND_JOINT_WRIST,
XRT_HAND_JOINT_THUMB_METACARPAL,
XRT_HAND_JOINT_THUMB_PROXIMAL,
XRT_HAND_JOINT_THUMB_DISTAL,
XRT_HAND_JOINT_THUMB_TIP,
XRT_HAND_JOINT_INDEX_PROXIMAL,
XRT_HAND_JOINT_INDEX_INTERMEDIATE,
XRT_HAND_JOINT_INDEX_DISTAL,
XRT_HAND_JOINT_INDEX_TIP,
XRT_HAND_JOINT_MIDDLE_PROXIMAL,
XRT_HAND_JOINT_MIDDLE_INTERMEDIATE,
XRT_HAND_JOINT_MIDDLE_DISTAL,
XRT_HAND_JOINT_MIDDLE_TIP,
XRT_HAND_JOINT_RING_PROXIMAL,
XRT_HAND_JOINT_RING_INTERMEDIATE,
XRT_HAND_JOINT_RING_DISTAL,
XRT_HAND_JOINT_RING_TIP,
XRT_HAND_JOINT_LITTLE_PROXIMAL,
XRT_HAND_JOINT_LITTLE_INTERMEDIATE,
XRT_HAND_JOINT_LITTLE_DISTAL,
XRT_HAND_JOINT_LITTLE_TIP,
}