我已经使用avfoundation将AR程序中iPad的ISO /白平衡/曝光值固定为固定值。我将iPad放在三脚架上。如果我将空间中的照明从A切换到B,然后再切换回A,则iPad显示屏的亮度和色彩不稳定。
有什么解决办法吗?
我尝试使用以下代码修复所有avfoundation变量,但显示仍会更改。
case .wbset2:
device2?.unlockForConfiguration()
do {
if ((try device2?.lockForConfiguration()) != nil) {
var g = (device2?.deviceWhiteBalanceGains)!
g.redGain = 1.685
g.greenGain = 1
g.blueGain = 2.367
device2?.setWhiteBalanceModeLocked(with: g, completionHandler: nil)
var dur: CMTime = device2!.exposureDuration
dur = CMTimeMake(value: 1964000, timescale: 1000000000)
device2?.automaticallyAdjustsVideoHDREnabled = false
device2?.setExposureModeCustom(duration: dur, iso: 121.9, completionHandler: nil)
try device2?.lockForConfiguration()
var wbg2 = device2?.deviceWhiteBalanceGains
lab_ij.text = "wb: \(wbg2)"
lab_exp.text = "duration: \(device2?.exposureDuration),iso:\(device2?.iso)"
}
} catch{
}