Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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)
    }
like image 537
Alex Stone Avatar asked Nov 06 '22 02:11

Alex Stone


1 Answers

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 }
like image 118
Andy Jazz Avatar answered Nov 14 '22 23:11

Andy Jazz