Accessing iOS 6 new APIs for camera exposure and shutter speed

后端 未结 5 2122
星月不相逢
星月不相逢 2020-11-29 01:59

On Apple\'s iOS 6.0 feature page, it used to say

Take advantage of the built-in camera’s advanced features. New APIs let you control focus, exposure,

5条回答
  •  粉色の甜心
    2020-11-29 02:17

    As a follow-up to Michael Grinich's excellent information, I found that there is an order dependency on some of the calls in the private API. To use "manual" exposure controls, you have to enable them before you set the mode, like so:

    #define AVCaptureExposureModeManual     3
    NSError*    error = nil;
    if ([captureDevice lockForConfiguration:&error]) {
        captureDevice.manualExposureSupportEnabled = YES;
        if ([captureDevice isExposureModeSupported:AVCaptureExposureModeManual]) {
            captureDevice.exposureMode = AVCaptureExposureModeManual;
            captureDevice.exposureGain = ...;
            captureDevice.exposureDuration = {...};
        }
        [captureDevice unlockForConfiguration];
    }
    

    All of this is demonstrated in iOS-ManualCamera.

提交回复
热议问题