I am trying to make auto focus work in my app, tested in iPad2. My problem is that when I called check methods like isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus, it always return NO. However, I could tap to focus with other camera applications in my device
devices = [AVCaptureDevice devicesWithMediaType:AVMediaTypeVideo];
for (AVCaptureDevice *tempDevice in devices) {
[tempDevice lockForConfiguration:nil];
if ([tempDevice isFocusModeSupported:AVCaptureFocusModeAutoFocus]) {
NSLog(@"Here");
}
if ([tempDevice isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocus]) {
NSLog(@"Here");
}
if ([tempDevice isFocusModeSupported:AVCaptureFocusModeLocked]) {
NSLog(@"Here");
}
if ([tempDevice isFocusPointOfInterestSupported]) {
NSLog(@"Here");
}
[tempDevice unlockForConfiguration];
}
I was just looking into this tonight. From what I have gleaned, the iPad 2 doesn’t do focus – it does exposure adjustment – so in the default Camera app, tapping the screen brings up a rect where the tap occurred indicating the area to do white point adjustment on.
Perhaps I am wrong but this is what I have turned up, and seems to be confirmed by your API (
isFocusModeSupported:AVCaptureFocusModeContinuousAutoFocusreturning NO) tests.The cameras in the iPad 2 are pretty weak – especially the front-facing one. I am surprised Apple shipped with that.
UPDATE: This is the code from the more recent AVCamDemo Apple sample that handles focus + exposure + white point. I don’t think this is in the AVCam example. AVCamDemo may onlly be available as a download of the WWDC code .dmg package from the developer center – not as a single download from the web.
On my iPad 2 the exposure code never gets called.
//-from AVCamDemo: