我試圖使用AVFoundation實現相機應用程序。我想用AVCaptureExposureModeAutoFocus設置exposurePointOfInterest在一個點,然後由蘋果的文檔解釋鎖定曝光:iPhone 5:iOS 7中不支持AVCaptureExposureModeAutoFocus
AVCaptureExposureModeAutoExpose:設備自動調整 曝光一次,然後改變曝光模式 AVCaptureExposureModeLocked。
這是我使用的功能:
-(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);
}
}
}
然而,自動曝光在所需點只是從來沒有發生過。在我使用下面的NSLog進行調試時,原來不支持AVCaputreExposureModeAutoExpose
。而如果我使用AVCaptureExposureModeContinuousAutoExpose
,它將完美運行。
我不明白這一點;這是真的,這個AVCaputreExposureModeAutoExpose
不支持iPhone 5的背部攝像頭運行iOS7?任何人有任何線索?謝謝!
調試代碼:
相關鍵實際上是「調整曝光」。 – nrj