Lef*_*eft 5 camera objective-c ios avcapturesession avcapturedevice
我正在使用 AVCaptureDevice 来捕获视频帧以进行一些图像处理,并希望通过使用控制曝光持续时间、ISO
setExposureModeCustomWithDuration:(CMTime)duration ISO:(float)ISO completionHandler:(void (^)(CMTime syncTime))handler
Run Code Online (Sandbox Code Playgroud)
我认为它将保持曝光水平作为我的设置。
当我将模式设置为 AVCaptureExposureModeCustom 时,当我移动相机以捕捉不同位置时,我可以看到预览图像的亮度发生了变化。(特别是从光明面到黑暗面)
但是当我将曝光模式更改为 AVCaptureExposureModeLocked 时,亮度将被固定。
我一直在检查白平衡,对焦,手电筒模式是否被锁定或禁用,isAdjustingExposure是否保持为false,并且在此问题发生期间曝光持续时间和ISO参数没有改变。
- (void) setCameraExposure:(CMTime)exposureDuration ISO:(int)iso
{
[self.avSession beginConfiguration];
AVCaptureDevice *videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
if (videoDevice) {
[videoDevice lockForConfiguration:nil];
// Set exposure duration and ISO in custom mode
if ([videoDevice isExposureModeSupported:AVCaptureExposureModeCustom]) {
[videoDevice setExposureModeCustomWithDuration:exposureDuration
ISO:iso
completionHandler:nil];
}
// If I use AVCaptureExposureModeLocked, the brightness was fixed
//if ([videoDevice isExposureModeSupported:AVCaptureExposureModeLocked]) {
// [videoDevice setExposureMode:AVCaptureExposureModeLocked];
//}
// Lock white balance
if ([videoDevice isWhiteBalanceModeSupported:AVCaptureWhiteBalanceModeLocked]) {
[videoDevice setWhiteBalanceMode:AVCaptureWhiteBalanceModeLocked];
}
[videoDevice unlockForConfiguration];
}
[self.avSession commitConfiguration];
}
Run Code Online (Sandbox Code Playgroud)
当我使用AVCaptureExposureModeCustom 时,我希望相机不改变亮度,这可能吗?我已经尝试了多种变体,但它们似乎都不起作用。有任何想法吗?
| 归档时间: |
|
| 查看次数: |
993 次 |
| 最近记录: |