# Converts hand landmarks to ROI.

type: "HandLandmarksToRoi"

# Hand landmarks. (NormalizedLandmarkList)
input_stream: "LANDMARKS:hand_landmarks"
# Image size (width & height). (std::pair<int, int>)
input_stream: "IMAGE_SIZE:image_size"

# ROI according to the hand landmarks. (NormalizedRect)
output_stream: "ROI:roi"

# Converts the hand landmarks into a rectangle (normalized by image size)
# that encloses the hand.
node {
  calculator: "HandLandmarksToRectCalculator"
  input_stream: "NORM_LANDMARKS:hand_landmarks"
  input_stream: "IMAGE_SIZE:image_size"
  output_stream: "NORM_RECT:palm_landmarks_rect"
}

# Expands the hand rectangle so that it's likely to contain the hand even with
# some motion.
node {
  calculator: "RectTransformationCalculator"
  input_stream: "NORM_RECT:palm_landmarks_rect"
  input_stream: "IMAGE_SIZE:image_size"
  output_stream: "roi"
  options: {
    [mediapipe.RectTransformationCalculatorOptions.ext] {
      scale_x: 2.0
      scale_y: 2.0
      shift_y: -0.1
      square_long: true
    }
  }
}
