ios - 固定的avfoundation变量,不同的显示亮度
问题描述
我已经使用 avfoundation 将 iPad 值的 ISO/白平衡/曝光值修复为 AR 应用程序中的固定值。我把 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{
}
解决方案
推荐阅读
- javascript - 如何使用 cypress 命令编写可重用的 javascript 函数
- mysql - java.sql.SQLInvalidAuthorizationSpecException:用户'root'@'10.24.1.77'的访问被拒绝(使用密码:是)
- javascript - 在 child_process 中并行运行多次相同的命令
- security - Mule 4 安全属性占位符不起作用
- java - %Like% 在spring JpaRepository中查询N个字段
- .net - 在 Delphi 7 中调用 C++ DLL 函数
- java - Keycloak 无法获取访问令牌
- javascript - 如何更新数组列表排序?
- css - 如何并行启动 2 个动画
- ios - Swift - 执行 segue 时视图控制器不会取消初始化