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