iOS8:相机:手动EV滑块

iOS 8: Camera: manual EV slider

先决条件: iOS 8、原生应用 任务: 开发显示在相机视图上方的滑块。滑块必须将相机的 EV 从其最低值更改为可能的最高值。

题目:

  1. 如何通过 iOS SDK 中的 ISO 和快门速度计算最大 possible/minimum possible/current EV 值? (我有吗?)这是了解滑块相对于其移动的步骤所必需的。
  2. 如何在滑块移动时正确设置 EV 值?据我了解,我可以同时更改 ISO 和快门速度。当滑块移动时,我应该如何使用它们将 EV 从其最小值更改为最大值?

来到这里是为了用答案结束这个问题。

这些教程和开源示例代码让您全面了解如何实现最初查询的内容:

  1. 关于相机手动控制的 Xamarin 教程不错。完全适用于 nativehttps://developer.xamarin.com/guides/ios/platform_features/intro_to_manual_camera_controls/
  2. 观看有关自定义相机控件的官方 Apple 视频:https://developer.apple.com/videos/play/wwdc2014/508/
  3. 获取他们的演示文稿:http://devstreaming.apple.com/videos/wwdc/2014/508xxfvaehrll14/508/508_camera_capture_manual_controls.pdf
  4. 并尝试他们很棒的样本: 4.1. AvCam 手册 https://developer.apple.com/library/ios/samplecode/AVCamManual/Introduction/Intro.html 4.2.和括号条纹 https://developer.apple.com/library/ios/samplecode/BracketStripes/Introduction/Intro.html

现在你已经满载了。

这是我们交付的结果:https://itunes.apple.com/us/app/slidecam/id1046798471?mt=8

只需使用此代码,您就可以设置自定义相机的 EV 值。确保滑块的值在 -8 到 8 之间。

- (IBAction)changeValueOfEVSliderAction:(id)sender
{
    UISlider *control = sender;
    NSError *error = nil;
    AVCaptureDevice *videoDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];

    if ( [videoDevice lockForConfiguration:&error] ) {
        [videoDevice setExposureTargetBias:control.value completionHandler:nil];
        [videoDevice unlockForConfiguration];
        //self.exposureTargetBiasValueLabel.text = [NSString stringWithFormat:@"%.1f", control.value];
    }
}

作为@DaddyM 的回答,请参考此AVCamManual: Extending AVCam to Use Manual Capture API了解更多详情。