2 Replies
      Latest reply on Mar 26, 2019 3:55 PM by gchiste
      ebeland Level 1 Level 1 (0 points)

        Does anyone know offhand how to hide the camera feed while doing ARKit face tracking? I am working on an Animoji like app.

         

        I can't seem to figure it out from the demos and docs. 

        • Re: ARKit face tracking
          bacchus_3 Level 1 Level 1 (0 points)

          I am exploring something like this too but seems like nobody has explored it yet? or was this discussed on different threads?

          • Re: ARKit face tracking
            gchiste Apple Staff Apple Staff (150 points)

            You can simply set up an ARSession (no ARSCNView or ARSKView required), here is a small example which shows how you can set up your own ARSession and use its data outside of an ARSCNView:

             

            import ARKit
            
            class ViewController: UIViewController, ARSessionDelegate {
               
                let session = ARSession()
               
                override func viewDidLoad() {
                    super.viewDidLoad()
                   
                    session.run(ARFaceTrackingConfiguration())
                    session.delegate = self
                   
                }
               
               
                func session(_ session: ARSession, didAdd anchors: [ARAnchor]) {
                    print(anchors)
                }
               
                func session(_ session: ARSession, didUpdate anchors: [ARAnchor]) {
                    for anchor in anchors {
                        if let faceAnchor = anchor as? ARFaceAnchor {
                            print(faceAnchor.blendShapes[ARFaceAnchor.BlendShapeLocation.mouthClose])
                        }
                    }
                }
               
            }

             

            Of course, you probably want to render something with that data, so you could use a plain SCNView to do so.