diff --git a/src/xrt/drivers/ht/ht_driver.c b/src/xrt/drivers/ht/ht_driver.c index 923c6cda1..cffa9e9fa 100644 --- a/src/xrt/drivers/ht/ht_driver.c +++ b/src/xrt/drivers/ht/ht_driver.c @@ -240,7 +240,6 @@ ht_device_create_common(struct t_stereo_camera_calibration *calib, int ht_device_create(struct xrt_frame_context *xfctx, struct t_stereo_camera_calibration *calib, - enum t_hand_tracking_output_space output_space, enum t_hand_tracking_algorithm algorithm_choice, struct t_image_boundary_info boundary_info, struct xrt_slam_sinks **out_sinks, @@ -254,7 +253,7 @@ ht_device_create(struct xrt_frame_context *xfctx, switch (algorithm_choice) { case HT_ALGORITHM_MERCURY: { - sync = t_hand_tracking_sync_mercury_create(calib, output_space, boundary_info); + sync = t_hand_tracking_sync_mercury_create(calib, boundary_info); } break; case HT_ALGORITHM_OLD_RGB: { //!@todo Either have this deal with the output space correctly, or have everything use LEFT_CAMERA @@ -296,7 +295,7 @@ ht_device_create_depthai_ov9282() 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); + sync = t_hand_tracking_sync_mercury_create(calib, info); struct ht_device *htd = ht_device_create_common(calib, true, &xfctx, sync); diff --git a/src/xrt/drivers/ht/ht_interface.h b/src/xrt/drivers/ht/ht_interface.h index 33ad3bf65..f406311bc 100644 --- a/src/xrt/drivers/ht/ht_interface.h +++ b/src/xrt/drivers/ht/ht_interface.h @@ -46,7 +46,6 @@ ht_device_create_index(struct xrt_prober *xp, struct t_stereo_camera_calibration * * @param xfctx WMR context to attach the tracker to * @param calib Calibration struct for stereo camera - * @param output_space What the origin of the output data should be * @param algorithm_choice Which algorithm to use for hand tracking * @param out_sinks Sinks to stream camera data to * @param out_device Newly created hand tracker "device" @@ -55,7 +54,6 @@ ht_device_create_index(struct xrt_prober *xp, struct t_stereo_camera_calibration int ht_device_create(struct xrt_frame_context *xfctx, struct t_stereo_camera_calibration *calib, - enum t_hand_tracking_output_space output_space, enum t_hand_tracking_algorithm algorithm_choice, struct t_image_boundary_info boundary_info, struct xrt_slam_sinks **out_sinks, diff --git a/src/xrt/drivers/wmr/wmr_hmd.c b/src/xrt/drivers/wmr/wmr_hmd.c index 85747654f..a54bff6b9 100644 --- a/src/xrt/drivers/wmr/wmr_hmd.c +++ b/src/xrt/drivers/wmr/wmr_hmd.c @@ -1497,12 +1497,11 @@ wmr_hmd_hand_track(struct wmr_hmd *wh, 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, // + int create_status = ht_device_create(&wh->tracking.xfctx, // + stereo_calib, // + HT_ALGORITHM_MERCURY, // + boundary_info, // + &sinks, // &device); if (create_status != 0) { return create_status; diff --git a/src/xrt/include/tracking/t_hand_tracking.h b/src/xrt/include/tracking/t_hand_tracking.h index ec627b132..77661eecd 100644 --- a/src/xrt/include/tracking/t_hand_tracking.h +++ b/src/xrt/include/tracking/t_hand_tracking.h @@ -76,20 +76,6 @@ struct t_image_boundary_info struct t_image_boundary_info_one_view views[2]; }; -/*! - * @brief Output coordinate system of the hand-tracking system. - * - * In HT_OUTPUT_SPACE_LEFT_CAMERA, the origin is at the left camera. - * In HT_OUTPUT_SPACE_CENTER_OF_STEREO_CAMERA (which you should not be using, because it assumes that your camera is a - * parallel stereo camera), the origin is at the "centerline" between the two main cameras. - * @ingroup xrt_iface - */ -enum t_hand_tracking_output_space -{ - HT_OUTPUT_SPACE_LEFT_CAMERA, - HT_OUTPUT_SPACE_CENTER_OF_STEREO_CAMERA, -}; - /*! * @brief Which hand-tracking algorithm should we use? * diff --git a/src/xrt/targets/common/target_builder_lighthouse.c b/src/xrt/targets/common/target_builder_lighthouse.c index c57f40d39..187b170d3 100644 --- a/src/xrt/targets/common/target_builder_lighthouse.c +++ b/src/xrt/targets/common/target_builder_lighthouse.c @@ -210,12 +210,11 @@ lighthouse_hand_track(struct u_system_devices *usysd, enum t_hand_tracking_algorithm ht_algorithm = old_rgb ? HT_ALGORITHM_OLD_RGB : HT_ALGORITHM_MERCURY; struct xrt_device *ht_device = NULL; - int create_status = ht_device_create(&usysd->xfctx, // - stereo_calib, // - HT_OUTPUT_SPACE_LEFT_CAMERA, // - ht_algorithm, // - info, // - &sinks, // + int create_status = ht_device_create(&usysd->xfctx, // + stereo_calib, // + ht_algorithm, // + info, // + &sinks, // &ht_device); if (create_status != 0) { LH_WARN("Failed to create hand tracking device\n"); diff --git a/src/xrt/tracking/hand/mercury/hg_interface.h b/src/xrt/tracking/hand/mercury/hg_interface.h index 168337a82..4592fb61c 100644 --- a/src/xrt/tracking/hand/mercury/hg_interface.h +++ b/src/xrt/tracking/hand/mercury/hg_interface.h @@ -23,7 +23,6 @@ extern "C" { */ struct t_hand_tracking_sync * t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib, - enum t_hand_tracking_output_space output_space, struct t_image_boundary_info boundary_info); #ifdef __cplusplus diff --git a/src/xrt/tracking/hand/mercury/hg_sync.cpp b/src/xrt/tracking/hand/mercury/hg_sync.cpp index 98ddaadba..0d4802d02 100644 --- a/src/xrt/tracking/hand/mercury/hg_sync.cpp +++ b/src/xrt/tracking/hand/mercury/hg_sync.cpp @@ -34,83 +34,6 @@ static const enum xrt_space_relation_flags valid_flags_ht = (enum xrt_space_rela * Setup helper functions. */ - -//!@todo -// This is cruft, necessary because some users still use HT_OUTPUT_SPACE_CENTER_OF_STEREO_CAMERA. -// WMR especially should *not* be using it, and for custom North Star/ -static void -get_left_camera_to_center(struct HandTracking *hgt, xrt::auxiliary::tracking::StereoCameraCalibrationWrapper &wrap) -{ - cv::Matx33d R1; - cv::Matx33d R2; - - cv::Matx34d P1; - cv::Matx34d P2; - - cv::Matx44d Q; - - // We only want R1 and R2, we don't care about anything else - if (hgt->use_fisheye) { - cv::fisheye::stereoRectify(wrap.view[0].intrinsics_mat, // cameraMatrix1 - wrap.view[0].distortion_fisheye_mat, // distCoeffs1 - wrap.view[1].intrinsics_mat, // cameraMatrix2 - wrap.view[1].distortion_fisheye_mat, // distCoeffs2 - wrap.view[0].image_size_pixels_cv, // imageSize* - wrap.camera_rotation_mat, // R - wrap.camera_translation_mat, // T - hgt->views[0].rotate_camera_to_stereo_camera, // R1 - hgt->views[1].rotate_camera_to_stereo_camera, // R2 - P1, // P1 - P2, // P2 - Q, // Q - 0, // flags - cv::Size()); // newImageSize - } else { - cv::stereoRectify(wrap.view[0].intrinsics_mat, // cameraMatrix1 - wrap.view[0].distortion_mat, // distCoeffs1 - wrap.view[1].intrinsics_mat, // cameraMatrix2 - wrap.view[1].distortion_mat, // distCoeffs2 - wrap.view[0].image_size_pixels_cv, // imageSize* - wrap.camera_rotation_mat, // R - wrap.camera_translation_mat, // T - hgt->views[0].rotate_camera_to_stereo_camera, // R1 - hgt->views[1].rotate_camera_to_stereo_camera, // R2 - P1, // P1 - P2, // P2 - Q, // Q - 0, // flags - -1.0f, // alpha - cv::Size(), // newImageSize - NULL, // validPixROI1 - NULL); // validPixROI2 - } - - // HG_DEBUG(hgt, "R%d ->", i); - // std::cout << hgt->views[i].rotate_camera_to_stereo_camera << std::endl; - - - // Untested, so far. - //!@todo Definitely this or getCalibration are doing a transpose and I don't know which. - cv::Matx33d rotate_stereo_camera_to_left_camera = hgt->views[0].rotate_camera_to_stereo_camera.inv(); - - xrt_matrix_3x3 s; - s.v[0] = rotate_stereo_camera_to_left_camera(0, 0); - s.v[1] = rotate_stereo_camera_to_left_camera(0, 1); - s.v[2] = rotate_stereo_camera_to_left_camera(0, 2); - - s.v[3] = rotate_stereo_camera_to_left_camera(1, 0); - s.v[4] = rotate_stereo_camera_to_left_camera(1, 1); - s.v[5] = rotate_stereo_camera_to_left_camera(1, 2); - - s.v[6] = rotate_stereo_camera_to_left_camera(2, 0); - s.v[7] = rotate_stereo_camera_to_left_camera(2, 1); - s.v[8] = rotate_stereo_camera_to_left_camera(2, 2); - - - math_quat_from_matrix_3x3(&s, &hgt->hand_pose_camera_offset.orientation); - hgt->hand_pose_camera_offset.position.x = -hgt->baseline / 2; -} - static bool getCalibration(struct HandTracking *hgt, t_stereo_camera_calibration *calibration) { @@ -195,10 +118,7 @@ getCalibration(struct HandTracking *hgt, t_stereo_camera_calibration *calibratio hgt->last_frame_one_view_size_px = hgt->calibration_one_view_size_px; hgt->multiply_px_coord_for_undistort = 1.0f; - switch (hgt->output_space) { - case HT_OUTPUT_SPACE_LEFT_CAMERA: hgt->hand_pose_camera_offset = XRT_POSE_IDENTITY; break; - case HT_OUTPUT_SPACE_CENTER_OF_STEREO_CAMERA: get_left_camera_to_center(hgt, wrap); break; - } + hgt->hand_pose_camera_offset = XRT_POSE_IDENTITY; @@ -1025,7 +945,6 @@ using namespace xrt::tracking::hand::mercury; extern "C" t_hand_tracking_sync * t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib, - enum t_hand_tracking_output_space output_space, struct t_image_boundary_info boundary_info) { XRT_TRACE_MARKER(); @@ -1036,8 +955,6 @@ t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib, hgt->log_level = xrt::tracking::hand::mercury::debug_get_log_option_mercury_log(); bool use_simdr = xrt::tracking::hand::mercury::debug_get_bool_option_mercury_use_simdr_keypoint(); - hgt->output_space = output_space; - /* * Get configuration */ diff --git a/src/xrt/tracking/hand/mercury/hg_sync.hpp b/src/xrt/tracking/hand/mercury/hg_sync.hpp index b0212c4ee..ca57c4ff8 100644 --- a/src/xrt/tracking/hand/mercury/hg_sync.hpp +++ b/src/xrt/tracking/hand/mercury/hg_sync.hpp @@ -187,8 +187,6 @@ public: bool use_fisheye; - enum t_hand_tracking_output_space output_space; - struct t_stereo_camera_calibration *calib; struct xrt_size calibration_one_view_size_px = {};