Type 'VNRecognizedPointKey' has no member 'thumbTip'

With the release of Xcode 13, a large section of my vision framework processing code became errors and cannot compile. All of these have became deprecated.

This is my original code:

 do {
      // Perform VNDetectHumanHandPoseRequest
      try handler.perform([handPoseRequest])
      // Continue only when a hand was detected in the frame.
      // Since we set the maximumHandCount property of the request to 1, there will be at most one observation.
      guard let observation = handPoseRequest.results?.first else {
        self.state = "no hand"
        return
      }
      // Get points for thumb and index finger.
      let thumbPoints = try observation.recognizedPoints(forGroupKey: .handLandmarkRegionKeyThumb)
      let indexFingerPoints = try observation.recognizedPoints(forGroupKey: .handLandmarkRegionKeyIndexFinger)
      let middleFingerPoints = try observation.recognizedPoints(forGroupKey: .handLandmarkRegionKeyMiddleFinger)
      let ringFingerPoints = try observation.recognizedPoints(forGroupKey: .handLandmarkRegionKeyRingFinger)
      let littleFingerPoints = try observation.recognizedPoints(forGroupKey: .handLandmarkRegionKeyLittleFinger)
      let wristPoints = try observation.recognizedPoints(forGroupKey: .all)
       
      // Look for tip points.
      guard let thumbTipPoint = thumbPoints[.handLandmarkKeyThumbTIP],
         let thumbIpPoint = thumbPoints[.handLandmarkKeyThumbIP],
         let thumbMpPoint = thumbPoints[.handLandmarkKeyThumbMP],
         let thumbCMCPoint = thumbPoints[.handLandmarkKeyThumbCMC] else {
        self.state = "no tip"
        return
      }
       
      guard let indexTipPoint = indexFingerPoints[.handLandmarkKeyIndexTIP],
         let indexDipPoint = indexFingerPoints[.handLandmarkKeyIndexDIP],
         let indexPipPoint = indexFingerPoints[.handLandmarkKeyIndexPIP],
         let indexMcpPoint = indexFingerPoints[.handLandmarkKeyIndexMCP] else {
        self.state = "no index"
        return
      }
       
      guard let middleTipPoint = middleFingerPoints[.handLandmarkKeyMiddleTIP],
         let middleDipPoint = middleFingerPoints[.handLandmarkKeyMiddleDIP],
         let middlePipPoint = middleFingerPoints[.handLandmarkKeyMiddlePIP],
         let middleMcpPoint = middleFingerPoints[.handLandmarkKeyMiddleMCP] else {
        self.state = "no middle"
        return
      }
       
      guard let ringTipPoint = ringFingerPoints[.handLandmarkKeyRingTIP],
         let ringDipPoint = ringFingerPoints[.handLandmarkKeyRingDIP],
         let ringPipPoint = ringFingerPoints[.handLandmarkKeyRingPIP],
         let ringMcpPoint = ringFingerPoints[.handLandmarkKeyRingMCP] else {
        self.state = "no ring"
        return
      }
       
      guard let littleTipPoint = littleFingerPoints[.handLandmarkKeyLittleTIP],
         let littleDipPoint = littleFingerPoints[.handLandmarkKeyLittleDIP],
         let littlePipPoint = littleFingerPoints[.handLandmarkKeyLittlePIP],
         let littleMcpPoint = littleFingerPoints[.handLandmarkKeyLittleMCP] else {
        self.state = "no little"
        return
      }
       
      guard let wristPoint = wristPoints[.handLandmarkKeyWrist] else {
        self.state = "no wrist"
        return
      }
...
}

Now every line from thumbPoints onwards results in error, I have fixed the first part (not sure if it is correct or not as it cannot compile) to :

        let thumbPoints = try observation.recognizedPoints(forGroupKey: VNHumanHandPoseObservation.JointsGroupName.thumb.rawValue)
       let indexFingerPoints = try observation.recognizedPoints(forGroupKey: VNHumanHandPoseObservation.JointsGroupName.indexFinger.rawValue)
       let middleFingerPoints = try observation.recognizedPoints(forGroupKey: VNHumanHandPoseObservation.JointsGroupName.middleFinger.rawValue)
       let ringFingerPoints = try observation.recognizedPoints(forGroupKey: VNHumanHandPoseObservation.JointsGroupName.ringFinger.rawValue)
       let littleFingerPoints = try observation.recognizedPoints(forGroupKey: VNHumanHandPoseObservation.JointsGroupName.littleFinger.rawValue)
       let wristPoints = try observation.recognizedPoints(forGroupKey: VNHumanHandPoseObservation.JointsGroupName.littleFinger.rawValue)

I tried many different things but just could not get the retrieving individual points to work. Can anyone help on fixing this?

Replies

Sorry to answer my own question, I have got it working. I think they not only changed the naming, but also changed how the function is called. Lastly, wrist is no longer a joint group name, so you can just obtain the point "wrist" instead of obtaining the group first.

For these who are interested:

       try handler.perform([handPoseRequest])
      // Continue only when a hand was detected in the frame.
      // Since we set the maximumHandCount property of the request to 1, there will be at most one observation.
      guard let observation = handPoseRequest.results?.first else {
        self.state = "no hand"
        return
      }
      // Get points for thumb and index finger.
      let thumbPoints = try observation.recognizedPoints(VNHumanHandPoseObservation.JointsGroupName.thumb)
      let indexFingerPoints = try observation.recognizedPoints(VNHumanHandPoseObservation.JointsGroupName.indexFinger)
      let middleFingerPoints = try observation.recognizedPoints(VNHumanHandPoseObservation.JointsGroupName.middleFinger)
      let ringFingerPoints = try observation.recognizedPoints(VNHumanHandPoseObservation.JointsGroupName.ringFinger)
      let littleFingerPoints = try observation.recognizedPoints(VNHumanHandPoseObservation.JointsGroupName.littleFinger)
      let wristPoint = try observation.recognizedPoint(VNHumanHandPoseObservation.JointName.wrist)

       
      // Look for tip points.
      guard let thumbTipPoint = thumbPoints[.thumbIP],
         let thumbIpPoint = thumbPoints[.thumbIP],
         let thumbMpPoint = thumbPoints[.thumbMP],
         let thumbCMCPoint = thumbPoints[.thumbCMC] else {
        self.state = "no tip"
        return
      }
       
      guard let indexTipPoint = indexFingerPoints[.indexTip],
         let indexDipPoint = indexFingerPoints[.indexDIP],
         let indexPipPoint = indexFingerPoints[.indexPIP],
         let indexMcpPoint = indexFingerPoints[.indexMCP] else {
        self.state = "no index"
        return
      }
       
      guard let middleTipPoint = middleFingerPoints[.middleTip],
         let middleDipPoint = middleFingerPoints[.middleDIP],
         let middlePipPoint = middleFingerPoints[.middlePIP],
         let middleMcpPoint = middleFingerPoints[.middleMCP] else {
        self.state = "no middle"
        return
      }
       
      guard let ringTipPoint = ringFingerPoints[.ringTip],
         let ringDipPoint = ringFingerPoints[.ringDIP],
         let ringPipPoint = ringFingerPoints[.ringPIP],
         let ringMcpPoint = ringFingerPoints[.ringMCP] else {
        self.state = "no ring"
        return
      }
       
      guard let littleTipPoint = littleFingerPoints[.littleTip],
         let littleDipPoint = littleFingerPoints[.littleDIP],
         let littlePipPoint = littleFingerPoints[.littlePIP],
         let littleMcpPoint = littleFingerPoints[.littleMCP] else {
        self.state = "no little"
        return
      }

That helped me interesting thing was Xcode was not suggesting new syntax.