chromium/third_party/mediapipe/src/mediapipe/modules/pose_landmark/pose_landmarks_to_roi.pbtxt

# MediaPipe graph to calculate pose region of interest (ROI) from landmarks
# detected by "PoseLandmarkByRoiCpu" or "PoseLandmarkByRoiGpu".
#
# NOTE: this graph is subject to change and should not be used directly.

type: "PoseLandmarksToRoi"

# Normalized landmarks. (NormalizedLandmarkList)
input_stream: "LANDMARKS:landmarks"
# Image size (width & height). (std::pair<int, int>)
input_stream: "IMAGE_SIZE:image_size"
# ROI according to landmarks. (NormalizedRect)
output_stream: "ROI:roi"

# Converts landmarks to a detection that tightly encloses all landmarks.
node {
  calculator: "LandmarksToDetectionCalculator"
  input_stream: "NORM_LANDMARKS:landmarks"
  output_stream: "DETECTION:detection"
}

# Converts detection into a rectangle based on center and scale alignment
# points.
node {
  calculator: "AlignmentPointsRectsCalculator"
  input_stream: "DETECTION:detection"
  input_stream: "IMAGE_SIZE:image_size"
  output_stream: "NORM_RECT:raw_roi"
  options: {
    [mediapipe.DetectionsToRectsCalculatorOptions.ext] {
      rotation_vector_start_keypoint_index: 0
      rotation_vector_end_keypoint_index: 1
      rotation_vector_target_angle_degrees: 90
    }
  }
}

# Expands pose rect with marging used during training.
node {
  calculator: "RectTransformationCalculator"
  input_stream: "NORM_RECT:raw_roi"
  input_stream: "IMAGE_SIZE:image_size"
  output_stream: "roi"
  options: {
    [mediapipe.RectTransformationCalculatorOptions.ext] {
      scale_x: 1.25
      scale_y: 1.25
      square_long: true
    }
  }
}