关于 ios:AVCaptureDevice 的 isLowLightBoostSupported 在 5S iOS7.1 上总是返回 false(对于 automaticEnablesLowLightBoostWhenAvailable)

AVCaptureDevice's isLowLightBoostSupported always returns false on 5S iOS7.1 (for automaticallyEnablesLowLightBoostWhenAvailable)

我正在尝试在 iOS 相机应用程序中启用 AVCaptureDevice 的 automaticEnablesLowLightBoostWhenAvailable,但我完全无法让 AVCaptureDevice 的 isLowLightBoostSupported 返回 true。

问题:除了锁定配置之外,还有什么需要做的事情来启用低光增强 api 吗?是否有任何已知原因导致 isL??owLightBoostSupported 在完全更新的现代系统上总是返回 false(对于所有设备)?

我正在使用 iOS 7.1 测试 5S。

为了简单起见,我已将更改移植到 Apple 的 AVCam 测试应用程序中。 AVCam 中的差异是这样的:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
diff --git a/AVCam/AVCam/AVCamViewController.m b/AVCam/AVCam/AVCamViewController.m
index 84a2c77..4e15fc4 100644
--- a/AVCam/AVCam/AVCamViewController.m
+++ b/AVCam/AVCam/AVCamViewController.m
@@ -175,6 +175,18 @@ static void * SessionRunningAndDeviceAuthorizedContext = &SessionRunningAndDevic
            [session addOutput:stillImageOutput];
            [self setStillImageOutput:stillImageOutput];
        }
+
+        if ([videoDevice respondsToSelector:@selector(isLowLightBoostSupported)]) {
+            if ([videoDevice lockForConfiguration:nil]) {
+                if (videoDevice.isLowLightBoostSupported) {
+                    videoDevice.automaticallyEnablesLowLightBoostWhenAvailable = YES;
+                    NSLog(@"was supported");
+                } else {
+                    NSLog(@"was not supported");
+                }
+                [videoDevice unlockForConfiguration];
+            }
+        }
    });
 }

为了更清楚起见,我已将该代码放在 GitHub 上的 AVCam 在线上下文中。

我浏览了文档和 SO 以试图找到答案。以下是一些对我当前代码的教育:

  • iPhone 5s 弱光增强模式
  • AVCaptureDevice 低光照增强不起作用
  • https://developer.apple.com/library/ios/documentation/AVFoundation/Reference/AVCaptureDevice_Class/Reference/Reference.html#//apple_ref/occ/instp/AVCaptureDevice/lowLightBoostSupported

我还尝试将 AVCaptureSession 实例的 sessionPreset 设置为所有 AVCaptureSessionPresetHigh、AVCaptureSessionPresetPhoto 和 AVCaptureSessionPresetLow,而对 isLowLightBoostSupported 的状态没有明显影响。

感谢您阅读本文 - 以及您可以提供的任何帮助! :)


据我了解,5S 不支持弱光增强模式。我对 Apple 在这方面的决定没有任何了解,但我猜对 5S 上的摄像头/传感器所做的改进已经足够好,以至于他们觉得该设备不需要弱光增强。

所以,您所看到的并不是错误。只是有些设备支持该功能(iPhone 5),有些不支持(iPhone 5S)。

我会发布兼容设备的列表,但我没有更新的 iPod Touch 和一些 iPad 来进行测试。我猜 iPhone 5c 确实支持它,因为该设备基本上是重新换过皮肤的 iPhone 5,但我再次没有要测试的设备。