iOS11 vision framework mapping all face landmarks

Viewed 7626

I am playing with vision framework and getting all landmark points with this code:

if let allFaceLandmarks = landmarks.allPoints {
    print(allFaceLandmarks)
}

But cant find mapping for these points. For example index numbers for right eye.

Looking for something the same as this, but for Vision framework instead.

4 Answers
lefty eyebrow   : 1~4
right eyebrow   : 5~8
left eye        : 9~16
right eye       : 17~24
outer mouth     : 25~34
inner mouth     : 35~40
left contour    : 41~45
chin            : 46
right contour   : 47~51
nose outline    : 52~60
nose crest      : 61~63
left tulip      : 64
right tulip     : 65

enter image description here

revision3

enter image description here

This post was super helpful for me, so I figured I would update it for iOS 13 (the original scope of the question is iOS 11). Starting with iOS 13, you will get a different set of points (VNDetectFaceLandmarksRequestRevision3) unless you manually specify the VNDetectFaceLandmarksRequestRevision2 revision. The revision parameter is only available in iOS12, so you need something like:

let faceLandmarksRequest = VNDetectFaceLandmarksRequest(completionHandler: self.myFaceFunction)

if #available(iOS 12.0, *) {
  // Force the revision to 2 (68-points) even on iOS 13 or greater 
  // when VNDetectFaceLandmarksRequestRevision3 is available. 
  faceLandmarksRequest.revision = 2
}

When I was updating my app talkr to iOS 13, I couldn't find a reference image for the new points like the one in this post, so I thought I would generate one. I hope it helps someone!

iOS 13 vision SDK revision 3 allpoints

Related