iOS ARKit4 - how to fix white balance for the ARCamera?

258 views Asked by At

I have an app that generates point cloud from multiple ARFrame. It appears that the camera used to capture the image has dynamic white balance, and can change it in the middle of a capture session.

How do I configure ARView, ARSession, or ARCamera to force it to lock white balance for the duration of the session?

I have access to the following parameters, but do not see anything related to white balance.

var arView: ARView!
let session: ARSession = arView.session
var sampleFrame: ARFrame = session.currentFrame! 
let camera = sampleFrame.camera


func configureSessionAndRun() {

        arView.automaticallyConfigureSession = false
        let configuration = ARWorldTrackingConfiguration()
        
        configuration.sceneReconstruction = .meshWithClassification
        configuration.frameSemantics = .smoothedSceneDepth
        configuration.planeDetection = [.horizontal, .vertical]
        
        configuration.environmentTexturing = .automatic
        
        arView.session.run(configuration)
    }
1

There are 1 answers

0
Andy Jazz On

There are only two AR View's properties that could help, but they are just gettable, not settable:

let frame = arView.session.currentFrame

frame?.camera.exposureDuration         // { get }
frame?.camera.exposureOffset           // { get }