访问 iOS 6 用于相机曝光和快门速度的新 API [英] Accessing iOS 6 new APIs for camera exposure and shutter speed

查看:18
本文介绍了访问 iOS 6 用于相机曝光和快门速度的新 API的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Apple 的 iOS 6.0 功能页面上,它曾经说

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

利用内置摄像头的高级功能.新的 API 让您可以控制焦点、曝光和感兴趣区域.您还可以通过人脸检测 API 访问和显示人脸,并利用支持硬件的视频稳定功能.

Take advantage of the built-in camera’s advanced features. New APIs let you control focus, exposure, and region of interest. You can also access and display faces with face detection APIs, and leverage hardware-enabled video stabilization.

此文本已被删除,我在 API 中找不到用于控制曝光的新方法.在曝光设置"下的 AVCaptureDevice 类中,没有适用于 iOS 6.0 的新属性/方法.你知道我在哪里可以找到 API 中公开的新功能吗?

This text has since been removed, and I can't find new methods in the API for controlling exposure. In class AVCaptureDevice under "Exposure Settings" there is no new property/method for iOS 6.0. Do you know where i can find new features for exposure in API?

推荐答案

AVCaptureDevice上确实有一个-exposureMode属性,但那只是设置模式(关闭/自动/连续)而不是实际的 f-stop、SS 或 ISO.提供曝光"控制的相机应用似乎都是通过后期处理完成的.

It's true that there is an -exposureMode property on AVCaptureDevice, but that's only for setting the mode (off/auto/continuous) and not the actual f-stop, SS, or ISO. Camera apps that provide "exposure" control all seem to do it through post-processing.

但是,框架中似乎有未记录的 API 可以执行此操作.查看 的完整标头AVCaptureDevice.h(通过 class-dump)并注意以下方法:

However, it seems there are undocumented APIs in the framework to do this. Check out the full headers for AVCaptureDevice.h (via a class-dump) and note the following methods:

- (void)setManualExposureSupportEnabled:(BOOL)arg1;
- (BOOL)isManualExposureSupportEnabled;

- (void)setExposureGain:(float)arg1;
- (float)exposureGain;

- (void)setExposureDuration:(struct { long long x1; int x2; unsigned int x3; long long x4; })arg1;
- (struct { long long x1; int x2; unsigned int x3; long long x4; })exposureDuration;

- (void)setExposureMode:(int)arg1;
- (int)exposureMode;

- (BOOL)isExposureModeSupported:(int)arg1;

我的猜测是 gain 是等效的 f-stop(固定光圈),而 duration 是快门速度.我想知道这些是否用于 iPhone 5 的 低光增强模式.

My guess is gain is equivalent f-stop (fixed aperture), and duration is shutter speed. I wonder if these are used for the iPhone 5's low-light boost mode.

您也可以使用 otool 四处寻找并尝试将符号拼凑在一起.exposureMode 中可能有一个用于启用手动控制的新常量,并且 exposureDuration 似乎也有标志.调用这些时,请确保使用新的 -isExposureModeSupported: 并调用 -respondsToSelector: 来检查兼容性.

You can also use otool to poke around and try to piece together the symbols. There's likely a new constant in exposureMode for enabling manual control, and exposureDuration seems like it has flags too. When calling these, make sure to use the new -isExposureModeSupported: and also call -respondsToSelector: to check compatibility.

与往常一样,Apple 不赞成使用私有 API,这也是 App Store 拒绝的原因.可能有解决此问题的方法,例如使用 -performSelector:obc_msgsend 带有 rot13 字符串或其他东西,因为我很确定他们只会这样做对应用程序二进制文件进行静态分析.

As always, using private APIs is frowned upon by Apple and is cause for rejection from the App Store. There might be ways around this, such as hiding the calls using -performSelector: or obc_msgsend with rot13 strings or something, as I'm pretty sure they only do static analysis on the app binary.

这篇关于访问 iOS 6 用于相机曝光和快门速度的新 API的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆