这是我一直试图尝试的一个问题。我知道iphone相机在连续(2)连续(2)以大多数(如果不是全部)相机应用程序启动,如AVFoundation框架中的AVCaptureDevice.h中所示:
enum {
AVCaptureWhiteBalanceModeLocked = 0,
AVCaptureWhiteBalanceModeAutoWhiteBalance = 1,
AVCaptureWhiteBalanceModeContinuousAutoWhiteBalance = 2,
};
但无论如何,我可以强制它以白平衡模式锁定开始吗?
我似乎无法找到它决定这种情况的地方。
我已尝试将其包含在我的捕获会话中:
// Create session (use default AVCaptureSessionPresetHigh)
AVCaptureSession *newCaptureSession = [[AVCaptureSession alloc] init];
[newCaptureSession beginConfiguration];
AVCaptureDevice *device = [self cameraWithPosition:AVCaptureDevicePositionBack];
if ([device isWhiteBalanceModeSupported: AVCaptureWhiteBalanceModeLocked]) {
if ([device lockForConfiguration:nil]) {
[device setWhiteBalanceMode:AVCaptureWhiteBalanceModeLocked];
[device unlockForConfiguration];
}
}
[newCaptureSession commitConfiguration];
......但无济于事。打开应用程序时,它仍然是自动白平衡。
答案 0 :(得分:0)
设置捕获会话时:
AVCaptureDevice *device = [self cameraWithPosition:AVCaptureDevicePositionBack];
if ([device isWhiteBalanceModeSupported: AVCaptureWhiteBalanceModeLocked]) {
if ([device lockForConfiguration:nil]) {
[device setWhiteBalanceMode:AVCaptureWhiteBalanceModeLocked];
[device unlockForConfiguration];
}
}