The open source OpenXR runtime
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

xrt: add hand_tracking_image_boundary_info

+71 -5
+27 -3
src/xrt/drivers/ht/ht_driver.c
··· 286 286 if (use_old_rgb) { 287 287 sync = t_hand_tracking_sync_old_rgb_create(calib); 288 288 } else { 289 - sync = t_hand_tracking_sync_mercury_create(calib, HT_OUTPUT_SPACE_LEFT_CAMERA); 289 + 290 + struct hand_tracking_image_boundary_info info; 291 + info.views[0].type = HT_IMAGE_BOUNDARY_CIRCLE; 292 + info.views[1].type = HT_IMAGE_BOUNDARY_CIRCLE; 293 + 294 + 295 + //!@todo This changes by like 50ish pixels from device to device. For now, the solution is simple: just 296 + //! make the circle a bit bigger than we'd like. 297 + // Maybe later we can do vignette calibration? Write a tiny optimizer that tries to fit Index's 298 + // gradient? Unsure. 299 + info.views[0].boundary.circle.normalized_center.x = 0.5f; 300 + info.views[0].boundary.circle.normalized_center.y = 0.5f; 301 + 302 + info.views[1].boundary.circle.normalized_center.x = 0.5f; 303 + info.views[1].boundary.circle.normalized_center.y = 0.5f; 304 + 305 + info.views[0].boundary.circle.normalized_radius = 0.55; 306 + info.views[1].boundary.circle.normalized_radius = 0.55; 307 + 308 + sync = t_hand_tracking_sync_mercury_create(calib, HT_OUTPUT_SPACE_LEFT_CAMERA, info); 290 309 } 291 310 292 311 struct ht_device *htd = ht_device_create_common(calib, true, &finder.xfctx, sync); ··· 340 359 struct t_stereo_camera_calibration *calib, 341 360 enum hand_tracking_output_space output_space, 342 361 enum hand_tracking_algorithm algorithm_choice, 362 + struct hand_tracking_image_boundary_info boundary_info, 343 363 struct xrt_slam_sinks **out_sinks, 344 364 struct xrt_device **out_device) 345 365 { ··· 347 367 XRT_TRACE_MARKER(); 348 368 assert(calib != NULL); 349 369 350 - struct t_hand_tracking_sync *sync = t_hand_tracking_sync_mercury_create(calib, output_space); 370 + struct t_hand_tracking_sync *sync = t_hand_tracking_sync_mercury_create(calib, output_space, boundary_info); 351 371 352 372 struct ht_device *htd = ht_device_create_common(calib, false, xfctx, sync); 353 373 ··· 380 400 381 401 struct t_hand_tracking_sync *sync; 382 402 383 - sync = t_hand_tracking_sync_mercury_create(calib, HT_OUTPUT_SPACE_LEFT_CAMERA); 403 + struct hand_tracking_image_boundary_info info; 404 + info.views[0].type = HT_IMAGE_BOUNDARY_NONE; 405 + info.views[1].type = HT_IMAGE_BOUNDARY_NONE; 406 + 407 + sync = t_hand_tracking_sync_mercury_create(calib, HT_OUTPUT_SPACE_LEFT_CAMERA, info); 384 408 385 409 struct ht_device *htd = ht_device_create_common(calib, true, &xfctx, sync); 386 410
+1
src/xrt/drivers/ht/ht_interface.h
··· 57 57 struct t_stereo_camera_calibration *calib, 58 58 enum hand_tracking_output_space output_space, 59 59 enum hand_tracking_algorithm algorithm_choice, 60 + struct hand_tracking_image_boundary_info boundary_info, 60 61 struct xrt_slam_sinks **out_sinks, 61 62 struct xrt_device **out_device); 62 63
+6
src/xrt/drivers/wmr/wmr_hmd.c
··· 1486 1486 struct xrt_device *device = NULL; 1487 1487 1488 1488 #ifdef XRT_BUILD_DRIVER_HANDTRACKING 1489 + //!@todo Turning it off is okay for now, but we should plug metric_radius (or whatever it's called) in, at some 1490 + //! point. 1491 + struct hand_tracking_image_boundary_info boundary_info; 1492 + boundary_info.views[0].type = HT_IMAGE_BOUNDARY_NONE; 1493 + boundary_info.views[1].type = HT_IMAGE_BOUNDARY_NONE; 1489 1494 1490 1495 int create_status = ht_device_create(&wh->tracking.xfctx, // 1491 1496 stereo_calib, // 1492 1497 HT_OUTPUT_SPACE_LEFT_CAMERA, // 1493 1498 HT_ALGORITHM_MERCURY, // 1499 + boundary_info, // 1494 1500 &sinks, // 1495 1501 &device); 1496 1502 if (create_status != 0) {
+31
src/xrt/include/tracking/t_hand_tracking.h
··· 30 30 HT_ALGORITHM_OLD_RGB 31 31 }; 32 32 33 + enum hand_tracking_image_boundary_type 34 + { 35 + HT_IMAGE_BOUNDARY_NONE, 36 + HT_IMAGE_BOUNDARY_CIRCLE, 37 + }; 38 + 39 + struct hand_tracking_image_boundary_circle 40 + { 41 + // The center, in normalized 0-1 UV coordinates. 42 + // Should probably be between 0 and 1 in pixel coordinates. 43 + struct xrt_vec2 normalized_center; 44 + // The radius, divided by the image width. 45 + // For Index, should be around 0.5. 46 + float normalized_radius; 47 + }; 48 + 49 + struct hand_tracking_image_boundary_info_one_view 50 + { 51 + enum hand_tracking_image_boundary_type type; 52 + union { 53 + struct hand_tracking_image_boundary_circle circle; 54 + } boundary; 55 + }; 56 + 57 + 58 + struct hand_tracking_image_boundary_info 59 + { 60 + //!@todo Hardcoded to 2 - needs to increase as we support headsets with more cameras. 61 + struct hand_tracking_image_boundary_info_one_view views[2]; 62 + }; 63 + 33 64 /*! 34 65 * Synchronously processes frames and returns two hands. 35 66 */
+3 -1
src/xrt/tracking/hand/mercury/hg_interface.h
··· 8 8 * @ingroup aux_tracking 9 9 */ 10 10 #pragma once 11 + #include "xrt/xrt_defines.h" 11 12 #include "tracking/t_tracking.h" 12 13 #include "tracking/t_hand_tracking.h" 13 14 ··· 22 23 */ 23 24 struct t_hand_tracking_sync * 24 25 t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib, 25 - enum hand_tracking_output_space output_space); 26 + enum hand_tracking_output_space output_space, 27 + struct hand_tracking_image_boundary_info boundary_info); 26 28 27 29 #ifdef __cplusplus 28 30 } // extern "C"
+3 -1
src/xrt/tracking/hand/mercury/hg_sync.cpp
··· 491 491 */ 492 492 493 493 extern "C" t_hand_tracking_sync * 494 - t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib, hand_tracking_output_space output_space) 494 + t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib, 495 + enum hand_tracking_output_space output_space, 496 + struct hand_tracking_image_boundary_info boundary_info) 495 497 { 496 498 XRT_TRACE_MARKER(); 497 499