jesu asir
jesu asir

Reputation: 121

How can I get the points in face mesh like eye ,eyebrow , lip, mouth ,nose using ARFaceTracking in Swift 4.2?

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?

Upvotes: 2

Views: 4639

Answers (3)

Ryan Chiang
Ryan Chiang

Reputation: 116

There's a free tool I made for this purpose: FaceLandmarks.com. Apple only provides limited documentation that maps vertex indices to specific facial landmarks.

So with this browser-based tool you can view the 1,220 vertices of ARFaceGeometry and identify specific vertices you need by clicking on them in 3D space.

For example, vertex 0 is in the middle, center of the upper lip. Hope this helps!

Upvotes: 0

luca992
luca992

Reputation: 1593

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)

Upvotes: 3

Diksha235
Diksha235

Reputation: 452

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.

Upvotes: 5

Related Questions