iPhone 5:AVCaptureExposureModeAutoFocus在iOS 7中不支持 [英] iPhone 5: AVCaptureExposureModeAutoFocus not supported in iOS 7
问题描述
我试图使用AVFoundation实现一个相机应用程序。我想使用AVCaptureExposureModeAutoFocus在某一点设置exposurePointOfInterest,然后根据Apple的文档解释锁定曝光:
AVCaptureExposureModeAutoExpose:,设备会自动调整
曝光一次,然后将曝光模式更改为
AVCaptureExposureModeLocked。
这是我使用的函数:
- (void)autoExposeAtPoint:(CGPoint)
AVCaptureDevice * device = [videoInput device];
if([device isExposurePointOfInterestSupported]&&& [device isExposureModeSupported:AVCaptureExposureModeAutoExpose]){
if([device lockForConfiguration:NULL]){
[device setExposurePointOfInterest:point]
[device setExposureMode:AVCaptureExposureModeAutoExpose];
[device unlockForConfiguration];
NSLog(@intereset的曝光点已设置为(%f,%f),point.x,point.y);
}
}
}
所需的点只是从来没有发生。当我使用NSLog调试下面,结果证明, AVCaputreExposureModeAutoExpose
不被支持。然而,如果我使用 AVCaptureExposureModeContinuousAutoExpose
,它会完美运行。
我不明白这一点;这是真的,这个 AVCaputreExposureModeAutoExpose
不支持运行iOS7的iPhone 5的后置摄像头吗?任何人有任何线索? THANKS!
调试代码:
NSLog(@issupported:%hhd,[device isExposurePointOfInterestSupported]);
NSLog(@ismodesupported:%hhd,[device isExposureModeSupported:AVCaptureExposureModeAutoExpose]);
**结果:**
issupported:1
ismodesupported:0
以下是他的回答:
正确。
您可以使用
,但是在
标题中定义的实现方式你自己的代码通过设置你想要的点
兴趣,然后调用
setExposureMode:AVCaptureExposureModeContinuousAutoExposure,然后
listen(键值观察)
AVCaptureDevice的isAdjustingExposure属性知道曝光何时完成调整。就像
一样,setExposureMode为AVCaptureExposureModeLocked。
I am trying to implement a camera application using AVFoundation. I want to use the AVCaptureExposureModeAutoFocus to set the exposurePointOfInterest at a point, and then lock the exposure as explained by Apple's documentation:
AVCaptureExposureModeAutoExpose: the device automatically adjusts the exposure once and then changes the exposure mode to AVCaptureExposureModeLocked.
This is the function that I used:
-(void)autoExposeAtPoint:(CGPoint)point
{
AVCaptureDevice *device = [videoInput device];
if([device isExposurePointOfInterestSupported] && [device isExposureModeSupported:AVCaptureExposureModeAutoExpose]){
if([device lockForConfiguration:NULL]){
[device setExposurePointOfInterest:point];
[device setExposureMode:AVCaptureExposureModeAutoExpose];
[device unlockForConfiguration];
NSLog(@"Exposure point of intereset has been set to (%f,%f)",point.x, point.y);
}
}
}
However, the auto exposure at the desired point just never happened. As I debugged using the NSLog below, it turned out that AVCaputreExposureModeAutoExpose
is not supported. Whereas, if I used AVCaptureExposureModeContinuousAutoExpose
, it would run perfectly.
I don't understand this; is this true that this AVCaputreExposureModeAutoExpose
is not supported in iPhone 5's back camera running iOS7? Anyone has any clue? THANKS!
Debug Code:
NSLog(@"issupported: %hhd", [device isExposurePointOfInterestSupported]);
NSLog(@"ismodesupported: %hhd" ,[device isExposureModeSupported:AVCaptureExposureModeAutoExpose]);
**Result:**
issupported: 1
ismodesupported: 0
I posted this question on Apple developer forum and got answered by Brad Ford (Core Media Engineering) the speaker for Camera with AV Foundation in Apple's WWDC.
Here's his answer:
Correct. AVCaptureExposureModeAutoExpose, while defined in the header, is not currently implemented on any iOS device.
You can however implement it in your own code by setting your desired point of interest, then calling setExposureMode:AVCaptureExposureModeContinuousAutoExposure, and then listen (key-value observe) the "isAdjustingExposure" property of AVCaptureDevice to know when the exposure finishes adjusting. As soon as it does, setExposureMode to AVCaptureExposureModeLocked.
这篇关于iPhone 5:AVCaptureExposureModeAutoFocus在iOS 7中不支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!