The open source OpenXR runtime
0
fork

Configure Feed

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

h/mercury: Don't show hands until tracked for 10 frames

+20 -5
+1
src/xrt/tracking/hand/mercury/hg_debug_instrumentation.hpp
··· 39 39 bool always_run_detection_model = false; 40 40 bool optimize_hand_size = true; 41 41 int max_num_outside_view = 6; 42 + size_t num_frames_before_display = 10; 42 43 bool enable_pose_predicted_input = true; 43 44 bool enable_framerate_based_smoothing = false; 44 45
+12 -1
src/xrt/tracking/hand/mercury/hg_sync.cpp
··· 507 507 // If we only have *one* frame, we just reuse the same bounding box and hope the hand 508 508 // hasn't moved too much. @todo 509 509 510 - HistoryBuffer<Eigen::Array<float, 3, 21>, 5> &hh = hgt->history_hands[hand_idx]; 510 + auto &hh = hgt->history_hands[hand_idx]; 511 511 512 512 513 513 if (hh.size() < 2) { ··· 974 974 ); 975 975 976 976 hgt->history_hands[hand_idx].push_back(asf); 977 + hgt->hand_tracked_for_num_frames[hand_idx]++; 977 978 } 978 979 979 980 // More hand-size-optimization spaghetti ··· 993 994 hgt->views[0].regions_of_interest_this_frame[hand_idx].found = false; 994 995 hgt->views[1].regions_of_interest_this_frame[hand_idx].found = false; 995 996 hgt->history_hands[hand_idx].clear(); 997 + hgt->hand_tracked_for_num_frames[hand_idx] = 0; 996 998 } 997 999 } 998 1000 ··· 1012 1014 } 1013 1015 } 1014 1016 1017 + for (int hand_idx = 0; hand_idx < 2; hand_idx++) { 1018 + // Don't send the hand to OpenXR until it's been tracked for 4 frames 1019 + if (hgt->hand_tracked_for_num_frames[hand_idx] < hgt->tuneable_values.num_frames_before_display) { 1020 + out_xrt_hands[hand_idx]->is_active = false; 1021 + } 1022 + } 1015 1023 1016 1024 // If the debug UI is active, push to the frame-timing widget 1017 1025 u_frame_times_widget_push_sample(&hgt->ft_widget, hgt->current_frame_timestamp); ··· 1194 1202 1195 1203 u_var_add_i32(hgt, &hgt->tuneable_values.max_num_outside_view, 1196 1204 "max allowed number of hand joints outside view"); 1205 + u_var_add_u64(hgt, &hgt->tuneable_values.num_frames_before_display, 1206 + "Number of frames before we show hands to OpenXR"); 1207 + 1197 1208 1198 1209 u_var_add_bool(hgt, &hgt->tuneable_values.scribble_predictions_into_next_frame, 1199 1210 "Scribble pose-predictions into next frame");
+7 -4
src/xrt/tracking/hand/mercury/hg_sync.hpp
··· 303 303 // Used to decide whether to run the keypoint estimator/nonlinear optimizer. 304 304 bool this_frame_hand_detected[2] = {false, false}; 305 305 306 - // Used to determine pose-predicted regions of interest. Contains the last five hand keypoint positions, or less 306 + // Used to determine pose-predicted regions of interest. Contains the last 2 hand keypoint positions, or less 307 307 // if the hand has just started being tracked. 308 - HistoryBuffer<Eigen::Array<float, 3, 21>, 5> history_hands[2] = {}; 308 + HistoryBuffer<Eigen::Array<float, 3, 21>, 2> history_hands[2] = {}; 309 + 310 + // Contains the last 2 timestamps, or less if hand tracking has just started. 311 + HistoryBuffer<uint64_t, 2> history_timestamps = {}; 309 312 310 - // Contains the last 5 timestamps, or less if hand tracking has just started. 311 - HistoryBuffer<uint64_t, 5> history_timestamps = {}; 313 + // It'd be a staring contest between your hand and the heat death of the universe! 314 + uint64_t hand_tracked_for_num_frames[2] = {0, 0}; 312 315 313 316 314 317 // left hand, right hand