mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
xrt: add hand_tracking_image_boundary_info
This commit is contained in:
parent
db85ea2df5
commit
8040224b39
|
@ -286,7 +286,26 @@ ht_device_create_index(struct xrt_prober *xp, struct t_stereo_camera_calibration
|
|||
if (use_old_rgb) {
|
||||
sync = t_hand_tracking_sync_old_rgb_create(calib);
|
||||
} else {
|
||||
sync = t_hand_tracking_sync_mercury_create(calib, HT_OUTPUT_SPACE_LEFT_CAMERA);
|
||||
|
||||
struct hand_tracking_image_boundary_info info;
|
||||
info.views[0].type = HT_IMAGE_BOUNDARY_CIRCLE;
|
||||
info.views[1].type = HT_IMAGE_BOUNDARY_CIRCLE;
|
||||
|
||||
|
||||
//!@todo This changes by like 50ish pixels from device to device. For now, the solution is simple: just
|
||||
//! make the circle a bit bigger than we'd like.
|
||||
// Maybe later we can do vignette calibration? Write a tiny optimizer that tries to fit Index's
|
||||
// gradient? Unsure.
|
||||
info.views[0].boundary.circle.normalized_center.x = 0.5f;
|
||||
info.views[0].boundary.circle.normalized_center.y = 0.5f;
|
||||
|
||||
info.views[1].boundary.circle.normalized_center.x = 0.5f;
|
||||
info.views[1].boundary.circle.normalized_center.y = 0.5f;
|
||||
|
||||
info.views[0].boundary.circle.normalized_radius = 0.55;
|
||||
info.views[1].boundary.circle.normalized_radius = 0.55;
|
||||
|
||||
sync = t_hand_tracking_sync_mercury_create(calib, HT_OUTPUT_SPACE_LEFT_CAMERA, info);
|
||||
}
|
||||
|
||||
struct ht_device *htd = ht_device_create_common(calib, true, &finder.xfctx, sync);
|
||||
|
@ -340,6 +359,7 @@ ht_device_create(struct xrt_frame_context *xfctx,
|
|||
struct t_stereo_camera_calibration *calib,
|
||||
enum hand_tracking_output_space output_space,
|
||||
enum hand_tracking_algorithm algorithm_choice,
|
||||
struct hand_tracking_image_boundary_info boundary_info,
|
||||
struct xrt_slam_sinks **out_sinks,
|
||||
struct xrt_device **out_device)
|
||||
{
|
||||
|
@ -347,7 +367,7 @@ ht_device_create(struct xrt_frame_context *xfctx,
|
|||
XRT_TRACE_MARKER();
|
||||
assert(calib != NULL);
|
||||
|
||||
struct t_hand_tracking_sync *sync = t_hand_tracking_sync_mercury_create(calib, output_space);
|
||||
struct t_hand_tracking_sync *sync = t_hand_tracking_sync_mercury_create(calib, output_space, boundary_info);
|
||||
|
||||
struct ht_device *htd = ht_device_create_common(calib, false, xfctx, sync);
|
||||
|
||||
|
@ -380,7 +400,11 @@ ht_device_create_depthai_ov9282()
|
|||
|
||||
struct t_hand_tracking_sync *sync;
|
||||
|
||||
sync = t_hand_tracking_sync_mercury_create(calib, HT_OUTPUT_SPACE_LEFT_CAMERA);
|
||||
struct hand_tracking_image_boundary_info info;
|
||||
info.views[0].type = HT_IMAGE_BOUNDARY_NONE;
|
||||
info.views[1].type = HT_IMAGE_BOUNDARY_NONE;
|
||||
|
||||
sync = t_hand_tracking_sync_mercury_create(calib, HT_OUTPUT_SPACE_LEFT_CAMERA, info);
|
||||
|
||||
struct ht_device *htd = ht_device_create_common(calib, true, &xfctx, sync);
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ ht_device_create(struct xrt_frame_context *xfctx,
|
|||
struct t_stereo_camera_calibration *calib,
|
||||
enum hand_tracking_output_space output_space,
|
||||
enum hand_tracking_algorithm algorithm_choice,
|
||||
struct hand_tracking_image_boundary_info boundary_info,
|
||||
struct xrt_slam_sinks **out_sinks,
|
||||
struct xrt_device **out_device);
|
||||
|
||||
|
|
|
@ -1486,11 +1486,17 @@ wmr_hmd_hand_track(struct wmr_hmd *wh,
|
|||
struct xrt_device *device = NULL;
|
||||
|
||||
#ifdef XRT_BUILD_DRIVER_HANDTRACKING
|
||||
//!@todo Turning it off is okay for now, but we should plug metric_radius (or whatever it's called) in, at some
|
||||
//! point.
|
||||
struct hand_tracking_image_boundary_info boundary_info;
|
||||
boundary_info.views[0].type = HT_IMAGE_BOUNDARY_NONE;
|
||||
boundary_info.views[1].type = HT_IMAGE_BOUNDARY_NONE;
|
||||
|
||||
int create_status = ht_device_create(&wh->tracking.xfctx, //
|
||||
stereo_calib, //
|
||||
HT_OUTPUT_SPACE_LEFT_CAMERA, //
|
||||
HT_ALGORITHM_MERCURY, //
|
||||
boundary_info, //
|
||||
&sinks, //
|
||||
&device);
|
||||
if (create_status != 0) {
|
||||
|
|
|
@ -30,6 +30,37 @@ enum hand_tracking_algorithm
|
|||
HT_ALGORITHM_OLD_RGB
|
||||
};
|
||||
|
||||
enum hand_tracking_image_boundary_type
|
||||
{
|
||||
HT_IMAGE_BOUNDARY_NONE,
|
||||
HT_IMAGE_BOUNDARY_CIRCLE,
|
||||
};
|
||||
|
||||
struct hand_tracking_image_boundary_circle
|
||||
{
|
||||
// The center, in normalized 0-1 UV coordinates.
|
||||
// Should probably be between 0 and 1 in pixel coordinates.
|
||||
struct xrt_vec2 normalized_center;
|
||||
// The radius, divided by the image width.
|
||||
// For Index, should be around 0.5.
|
||||
float normalized_radius;
|
||||
};
|
||||
|
||||
struct hand_tracking_image_boundary_info_one_view
|
||||
{
|
||||
enum hand_tracking_image_boundary_type type;
|
||||
union {
|
||||
struct hand_tracking_image_boundary_circle circle;
|
||||
} boundary;
|
||||
};
|
||||
|
||||
|
||||
struct hand_tracking_image_boundary_info
|
||||
{
|
||||
//!@todo Hardcoded to 2 - needs to increase as we support headsets with more cameras.
|
||||
struct hand_tracking_image_boundary_info_one_view views[2];
|
||||
};
|
||||
|
||||
/*!
|
||||
* Synchronously processes frames and returns two hands.
|
||||
*/
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
* @ingroup aux_tracking
|
||||
*/
|
||||
#pragma once
|
||||
#include "xrt/xrt_defines.h"
|
||||
#include "tracking/t_tracking.h"
|
||||
#include "tracking/t_hand_tracking.h"
|
||||
|
||||
|
@ -22,7 +23,8 @@ extern "C" {
|
|||
*/
|
||||
struct t_hand_tracking_sync *
|
||||
t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib,
|
||||
enum hand_tracking_output_space output_space);
|
||||
enum hand_tracking_output_space output_space,
|
||||
struct hand_tracking_image_boundary_info boundary_info);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
|
|
@ -491,7 +491,9 @@ HandTracking::cCallbackDestroy(t_hand_tracking_sync *ht_sync)
|
|||
*/
|
||||
|
||||
extern "C" t_hand_tracking_sync *
|
||||
t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib, hand_tracking_output_space output_space)
|
||||
t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib,
|
||||
enum hand_tracking_output_space output_space,
|
||||
struct hand_tracking_image_boundary_info boundary_info)
|
||||
{
|
||||
XRT_TRACE_MARKER();
|
||||
|
||||
|
|
Loading…
Reference in a new issue