# Extracts hand wrist landmark to be used instead of pose wrist landmark.

type: "HandWristForPose"

# Hand landmarks to take wrist landmark from. (NormalizedLandmarkList)
input_stream: "HAND_LANDMARKS:hand_landmarks"

# Hand wrist landmark to replace original pose wrist landmark with updated
# visibility. (NormalizedLandmarkList)
output_stream: "WRIST_LANDMARK:hand_wrist_landmark_with_visibility"

# Side packet with constant for visibility score. As score is `x` from
# `sigmoid(x)` we pick some big value that doesn't affect pose landmarks
# visibility rendering threshold.
node {
  calculator: "ConstantSidePacketCalculator"
  output_side_packet: "PACKET:0:visible_score_side_packet"
  options: {
    [mediapipe.ConstantSidePacketCalculatorOptions.ext]: {
      packet { float_value: 100.0 }
    }
  }
}

# Converts side packet with visibility score to a stream.
node {
  calculator: "SidePacketToStreamCalculator"
  input_stream: "TICK:hand_landmarks"
  input_side_packet: "visible_score_side_packet"
  output_stream: "AT_TICK:visible_score"
}

# Extracts wrist landmark from the hand landmarks.
node {
  calculator: "SplitNormalizedLandmarkListCalculator"
  input_stream: "hand_landmarks"
  output_stream: "hand_wrist_landmark"
  options: {
    [mediapipe.SplitVectorCalculatorOptions.ext] {
      ranges: { begin: 0 end: 1 }
    }
  }
}

# Sets wrist landmark visibility score. If HAND_LANDMARKS is non-empty - wrist
# will always be visible.
node {
  calculator: "SetLandmarkVisibilityCalculator"
  input_stream: "NORM_LANDMARKS:hand_wrist_landmark"
  input_stream: "VISIBILITY:visible_score"
  output_stream: "NORM_LANDMARKS:hand_wrist_landmark_with_visibility"
}
