The open source OpenXR runtime
0
fork

Configure Feed

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

xrt: Remove t_hand_tracking_output_space

LEFT_CAMERA is the only one that remained useful

authored by

Moses Turner and committed by
Jakob Bornecrantz
c0eed827 a5c0f0b4

+13 -118
+2 -3
src/xrt/drivers/ht/ht_driver.c
··· 240 240 int 241 241 ht_device_create(struct xrt_frame_context *xfctx, 242 242 struct t_stereo_camera_calibration *calib, 243 - enum t_hand_tracking_output_space output_space, 244 243 enum t_hand_tracking_algorithm algorithm_choice, 245 244 struct t_image_boundary_info boundary_info, 246 245 struct xrt_slam_sinks **out_sinks, ··· 254 253 255 254 switch (algorithm_choice) { 256 255 case HT_ALGORITHM_MERCURY: { 257 - sync = t_hand_tracking_sync_mercury_create(calib, output_space, boundary_info); 256 + sync = t_hand_tracking_sync_mercury_create(calib, boundary_info); 258 257 } break; 259 258 case HT_ALGORITHM_OLD_RGB: { 260 259 //!@todo Either have this deal with the output space correctly, or have everything use LEFT_CAMERA ··· 296 295 info.views[0].type = HT_IMAGE_BOUNDARY_NONE; 297 296 info.views[1].type = HT_IMAGE_BOUNDARY_NONE; 298 297 299 - sync = t_hand_tracking_sync_mercury_create(calib, HT_OUTPUT_SPACE_LEFT_CAMERA, info); 298 + sync = t_hand_tracking_sync_mercury_create(calib, info); 300 299 301 300 struct ht_device *htd = ht_device_create_common(calib, true, &xfctx, sync); 302 301
-2
src/xrt/drivers/ht/ht_interface.h
··· 46 46 * 47 47 * @param xfctx WMR context to attach the tracker to 48 48 * @param calib Calibration struct for stereo camera 49 - * @param output_space What the origin of the output data should be 50 49 * @param algorithm_choice Which algorithm to use for hand tracking 51 50 * @param out_sinks Sinks to stream camera data to 52 51 * @param out_device Newly created hand tracker "device" ··· 55 54 int 56 55 ht_device_create(struct xrt_frame_context *xfctx, 57 56 struct t_stereo_camera_calibration *calib, 58 - enum t_hand_tracking_output_space output_space, 59 57 enum t_hand_tracking_algorithm algorithm_choice, 60 58 struct t_image_boundary_info boundary_info, 61 59 struct xrt_slam_sinks **out_sinks,
+5 -6
src/xrt/drivers/wmr/wmr_hmd.c
··· 1497 1497 boundary_info.views[0].type = HT_IMAGE_BOUNDARY_NONE; 1498 1498 boundary_info.views[1].type = HT_IMAGE_BOUNDARY_NONE; 1499 1499 1500 - int create_status = ht_device_create(&wh->tracking.xfctx, // 1501 - stereo_calib, // 1502 - HT_OUTPUT_SPACE_LEFT_CAMERA, // 1503 - HT_ALGORITHM_MERCURY, // 1504 - boundary_info, // 1505 - &sinks, // 1500 + int create_status = ht_device_create(&wh->tracking.xfctx, // 1501 + stereo_calib, // 1502 + HT_ALGORITHM_MERCURY, // 1503 + boundary_info, // 1504 + &sinks, // 1506 1505 &device); 1507 1506 if (create_status != 0) { 1508 1507 return create_status;
-14
src/xrt/include/tracking/t_hand_tracking.h
··· 77 77 }; 78 78 79 79 /*! 80 - * @brief Output coordinate system of the hand-tracking system. 81 - * 82 - * In HT_OUTPUT_SPACE_LEFT_CAMERA, the origin is at the left camera. 83 - * In HT_OUTPUT_SPACE_CENTER_OF_STEREO_CAMERA (which you should not be using, because it assumes that your camera is a 84 - * parallel stereo camera), the origin is at the "centerline" between the two main cameras. 85 - * @ingroup xrt_iface 86 - */ 87 - enum t_hand_tracking_output_space 88 - { 89 - HT_OUTPUT_SPACE_LEFT_CAMERA, 90 - HT_OUTPUT_SPACE_CENTER_OF_STEREO_CAMERA, 91 - }; 92 - 93 - /*! 94 80 * @brief Which hand-tracking algorithm should we use? 95 81 * 96 82 * Never use HT_ALGORITHM_OLD_RGB. The tracking quality is extremely poor.
+5 -6
src/xrt/targets/common/target_builder_lighthouse.c
··· 210 210 enum t_hand_tracking_algorithm ht_algorithm = old_rgb ? HT_ALGORITHM_OLD_RGB : HT_ALGORITHM_MERCURY; 211 211 212 212 struct xrt_device *ht_device = NULL; 213 - int create_status = ht_device_create(&usysd->xfctx, // 214 - stereo_calib, // 215 - HT_OUTPUT_SPACE_LEFT_CAMERA, // 216 - ht_algorithm, // 217 - info, // 218 - &sinks, // 213 + int create_status = ht_device_create(&usysd->xfctx, // 214 + stereo_calib, // 215 + ht_algorithm, // 216 + info, // 217 + &sinks, // 219 218 &ht_device); 220 219 if (create_status != 0) { 221 220 LH_WARN("Failed to create hand tracking device\n");
-1
src/xrt/tracking/hand/mercury/hg_interface.h
··· 23 23 */ 24 24 struct t_hand_tracking_sync * 25 25 t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib, 26 - enum t_hand_tracking_output_space output_space, 27 26 struct t_image_boundary_info boundary_info); 28 27 29 28 #ifdef __cplusplus
+1 -84
src/xrt/tracking/hand/mercury/hg_sync.cpp
··· 34 34 * Setup helper functions. 35 35 */ 36 36 37 - 38 - //!@todo 39 - // This is cruft, necessary because some users still use HT_OUTPUT_SPACE_CENTER_OF_STEREO_CAMERA. 40 - // WMR especially should *not* be using it, and for custom North Star/ 41 - static void 42 - get_left_camera_to_center(struct HandTracking *hgt, xrt::auxiliary::tracking::StereoCameraCalibrationWrapper &wrap) 43 - { 44 - cv::Matx33d R1; 45 - cv::Matx33d R2; 46 - 47 - cv::Matx34d P1; 48 - cv::Matx34d P2; 49 - 50 - cv::Matx44d Q; 51 - 52 - // We only want R1 and R2, we don't care about anything else 53 - if (hgt->use_fisheye) { 54 - cv::fisheye::stereoRectify(wrap.view[0].intrinsics_mat, // cameraMatrix1 55 - wrap.view[0].distortion_fisheye_mat, // distCoeffs1 56 - wrap.view[1].intrinsics_mat, // cameraMatrix2 57 - wrap.view[1].distortion_fisheye_mat, // distCoeffs2 58 - wrap.view[0].image_size_pixels_cv, // imageSize* 59 - wrap.camera_rotation_mat, // R 60 - wrap.camera_translation_mat, // T 61 - hgt->views[0].rotate_camera_to_stereo_camera, // R1 62 - hgt->views[1].rotate_camera_to_stereo_camera, // R2 63 - P1, // P1 64 - P2, // P2 65 - Q, // Q 66 - 0, // flags 67 - cv::Size()); // newImageSize 68 - } else { 69 - cv::stereoRectify(wrap.view[0].intrinsics_mat, // cameraMatrix1 70 - wrap.view[0].distortion_mat, // distCoeffs1 71 - wrap.view[1].intrinsics_mat, // cameraMatrix2 72 - wrap.view[1].distortion_mat, // distCoeffs2 73 - wrap.view[0].image_size_pixels_cv, // imageSize* 74 - wrap.camera_rotation_mat, // R 75 - wrap.camera_translation_mat, // T 76 - hgt->views[0].rotate_camera_to_stereo_camera, // R1 77 - hgt->views[1].rotate_camera_to_stereo_camera, // R2 78 - P1, // P1 79 - P2, // P2 80 - Q, // Q 81 - 0, // flags 82 - -1.0f, // alpha 83 - cv::Size(), // newImageSize 84 - NULL, // validPixROI1 85 - NULL); // validPixROI2 86 - } 87 - 88 - // HG_DEBUG(hgt, "R%d ->", i); 89 - // std::cout << hgt->views[i].rotate_camera_to_stereo_camera << std::endl; 90 - 91 - 92 - // Untested, so far. 93 - //!@todo Definitely this or getCalibration are doing a transpose and I don't know which. 94 - cv::Matx33d rotate_stereo_camera_to_left_camera = hgt->views[0].rotate_camera_to_stereo_camera.inv(); 95 - 96 - xrt_matrix_3x3 s; 97 - s.v[0] = rotate_stereo_camera_to_left_camera(0, 0); 98 - s.v[1] = rotate_stereo_camera_to_left_camera(0, 1); 99 - s.v[2] = rotate_stereo_camera_to_left_camera(0, 2); 100 - 101 - s.v[3] = rotate_stereo_camera_to_left_camera(1, 0); 102 - s.v[4] = rotate_stereo_camera_to_left_camera(1, 1); 103 - s.v[5] = rotate_stereo_camera_to_left_camera(1, 2); 104 - 105 - s.v[6] = rotate_stereo_camera_to_left_camera(2, 0); 106 - s.v[7] = rotate_stereo_camera_to_left_camera(2, 1); 107 - s.v[8] = rotate_stereo_camera_to_left_camera(2, 2); 108 - 109 - 110 - math_quat_from_matrix_3x3(&s, &hgt->hand_pose_camera_offset.orientation); 111 - hgt->hand_pose_camera_offset.position.x = -hgt->baseline / 2; 112 - } 113 - 114 37 static bool 115 38 getCalibration(struct HandTracking *hgt, t_stereo_camera_calibration *calibration) 116 39 { ··· 195 118 hgt->last_frame_one_view_size_px = hgt->calibration_one_view_size_px; 196 119 hgt->multiply_px_coord_for_undistort = 1.0f; 197 120 198 - switch (hgt->output_space) { 199 - case HT_OUTPUT_SPACE_LEFT_CAMERA: hgt->hand_pose_camera_offset = XRT_POSE_IDENTITY; break; 200 - case HT_OUTPUT_SPACE_CENTER_OF_STEREO_CAMERA: get_left_camera_to_center(hgt, wrap); break; 201 - } 121 + hgt->hand_pose_camera_offset = XRT_POSE_IDENTITY; 202 122 203 123 204 124 ··· 1025 945 1026 946 extern "C" t_hand_tracking_sync * 1027 947 t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib, 1028 - enum t_hand_tracking_output_space output_space, 1029 948 struct t_image_boundary_info boundary_info) 1030 949 { 1031 950 XRT_TRACE_MARKER(); ··· 1035 954 // Setup logging first. We like logging. 1036 955 hgt->log_level = xrt::tracking::hand::mercury::debug_get_log_option_mercury_log(); 1037 956 bool use_simdr = xrt::tracking::hand::mercury::debug_get_bool_option_mercury_use_simdr_keypoint(); 1038 - 1039 - hgt->output_space = output_space; 1040 957 1041 958 /* 1042 959 * Get configuration
-2
src/xrt/tracking/hand/mercury/hg_sync.hpp
··· 187 187 188 188 bool use_fisheye; 189 189 190 - enum t_hand_tracking_output_space output_space; 191 - 192 190 struct t_stereo_camera_calibration *calib; 193 191 194 192 struct xrt_size calibration_one_view_size_px = {};