Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to run ARWorldTracking Session and ARFaceTracking Session at the same time on iPhoneX?

I'm trying to run ARWorldTracking Session and ARFaceTracking Session at the same time on iPhoneX, but the first running session stopped after the later session begun to run.

Is is impossible to implement? This is my ViewController.swift code.

import UIKit
import ARKit

class ViewController: UIViewController, ARSCNViewDelegate, 
ARSessionDelegate {
    @IBOutlet weak var frontView: ARSCNView!
    @IBOutlet weak var backView: ARSCNView!
    override func viewDidLoad() {
       super.viewDidLoad()
       startTracking()
    }

   func startTracking() {
       let backConfiguration = ARWorldTrackingConfiguration()
       backView.session.run(backConfiguration)

       let frontConfiguration = ARFaceTrackingConfiguration()
       frontConfiguration.isLightEstimationEnabled = true      
       frontView.session.run(frontConfiguration)
  }
}
like image 497
Scoff Avatar asked Nov 08 '22 13:11

Scoff


1 Answers

Nope.

ARKit relies upon the AVCapture system, and that doesn’t support using more than one capture device (camera) at a time. If you start a capture session using the front camera while another session is using the back camera, the existing session stops.

like image 178
rickster Avatar answered Nov 14 '22 21:11

rickster