3

Currently i am getting the left and right eye points, How can i get the other parts points using ARFaceTracking or other framework in swift 4 in ios.

please give the feedback above the questions?

Sham Dhiman
  • 1,348
  • 1
  • 21
  • 59
jesu asir
  • 123
  • 2
  • 9

2 Answers2

5

You can use the ARFaceGeometry vertices. It’s a magic number. The ARFaceGeometry has 1220 vertices in it and index 9 is on the nose. This works.

let vertices = [anchor.geometry.vertices[9]] // nose

// You can use Features Indexes with array
let features = ["nose", "leftEye", "rightEye", "mouth", "hat"]
let featureIndices = [[9], [1064], [42], [24, 25], [20]]

Here features is an array of the node names you gave to each feature and featureIndices are the vertex indexes in the ARFaceGeometry that correspond to those features. ARFaceAnchor property is used.

Diksha235
  • 442
  • 7
  • 17
  • @jesuasir Please find this code may be it will be useful >>https://www.raywenderlich.com/5491-ar-face-tracking-tutorial-for-ios-getting-started >>https://github.com/mattlawer/FaceLandmarksDetection/tree/master/DetectFaceLandmarks – Diksha235 Jan 09 '19 at 06:37
  • @jesuasir Also you can go through these blend shapes coefficients . Check them out in Apple’s official documentation at https://developer.apple.com/documentation/arkit/arfaceanchor/blendshapelocation – Diksha235 Jan 09 '19 at 06:40
  • 2
    right eye indices go from 1085 to 1108 and left eye indices go from 1061 to 1084 – P1xelfehler Aug 23 '21 at 19:18
  • @P1xelfehler You probably just saved me an hour or two. – luca992 Nov 17 '21 at 07:05
2

Here's some magic numbers for you:

let mouthTopLeft = Array(250...256)
let mouthTopCenter = [24]
let mouthTopRight = Array(685...691).reversed()
let mouthRight = [684]
let mouthBottomRight = [682, 683,700,709,710,725]
let mouthBottomCenter = [25]
let mouthBottomLeft = [265,274,290,275,247,248]
let mouthLeft = [249]
let mouthClockwise : [Int] = mouthLeft +
                               mouthTopLeft + mouthTopCenter +
                               mouthTopRight + mouthRight +
                               mouthBottomRight + mouthBottomCenter +
                               mouthBottomLeft
let eyeTopLeft = Array(1090...1101)
let eyeBottomLeft = Array(1102...1108) + Array(1085...1089)
let eyeTopRight = Array(1069...1080)
let eyeBottomRight = Array(1081...1084) + Array(1061...1068)
luca992
  • 1,548
  • 22
  • 27