简体   繁体   中英

How to draw a custom boundary around ARSCNFaceGeometry mesh

What is the simplest way to draw a boundary around the detected face mesh obtained by:

let faceGeometry = ARSCNFaceGeometry(device: device)
let node = SCNNode(geometry: faceGeometry)
node.geometry?.firstMaterial?.fillMode = .lines

in the renderer?

I am new to ARKit and I assume UIBezier methods do not work here.

There was no built-in way to do this. You have to find the vertices in face mesh which surround the face and then use their positions to draw the boundary (using, for example, SCNNode Cylinders). I felt this could be useful to others so I wrote an iOS app to help other developpers:

Face Mesh App on Apple App Store: https://itunes.apple.com/ca/app/face-mesh/id1439354562?mt=8

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM