# Decides what ROI to use for hand landmark prediction: either previous frame # landmarks ROI or current frame re-crop ROI. type: "HandTracking" # Hand landmarks from the current frame. They will be memorized for tracking on # the next frame. (NormalizedLandmarkList) input_stream: "LANDMARKS:hand_landmarks" # Hand re-crop ROI from the current frame. (NormalizedRect) input_stream: "HAND_ROI_FROM_RECROP:hand_roi_from_recrop" # Image size (width & height). (std::pair) input_stream: "IMAGE_SIZE:image_size" # Hand tracking ROI. Which is either hand landmarks ROI from the previous frame # if hand is still tracked, or hand re-crop ROI from the current frame # othervise. (NormalizedRect) output_stream: "HAND_TRACKING_ROI:hand_tracking_roi" # Keeps track of hand landmarks from the previous frame. node { calculator: "PreviousLoopbackCalculator" # TODO: check that loop works with image size instead of video. input_stream: "MAIN:image_size" input_stream: "LOOP:hand_landmarks" input_stream_info: { tag_index: "LOOP" back_edge: true } output_stream: "PREV_LOOP:prev_hand_landmarks" } # Gets hand landarmsk rect. node { calculator: "HandLandmarksToRoi" input_stream: "LANDMARKS:prev_hand_landmarks" input_stream: "IMAGE_SIZE:image_size" output_stream: "ROI:prev_hand_landmarks_roi" } # Checks that all requirements for tracking are satisfied and use hand rectangle # from the previous frame in that case. Otherwise - use hand re-crop rectangle # from the current frame. node { calculator: "RoiTrackingCalculator" input_stream: "PREV_LANDMARKS:prev_hand_landmarks" input_stream: "PREV_LANDMARKS_RECT:prev_hand_landmarks_roi" input_stream: "RECROP_RECT:hand_roi_from_recrop" input_stream: "IMAGE_SIZE:image_size" output_stream: "TRACKING_RECT:hand_tracking_roi" options: { [mediapipe.RoiTrackingCalculatorOptions.ext] { rect_requirements: { rotation_degrees: 40.0 translation: 0.2 # TODO: adjust scale for hand tracking. scale: 0.4 } landmarks_requirements: { recrop_rect_margin: -0.1 } } } }