Reputation: 1221
When I open the default camera app of iOS, I can see a big blue square whenever I make a change in the scene, which I think takes care of the exposure. If I click somewhere, it sets the exposure point of interest, but the new box is quite small. Is it that in iOS, default camera is using a bigger area to set exposure, but if I set an exposure point of interest explicitly, little area around the point will be considered?
What if I want to set the same settings (in terms of exposure) for my own app, which I am building using AVFoundation?
In documentation it is written that setiing exposure point is (0.5,0.5)
and setting AVFoundationExposureModeCOntinuousAutoExposure
as exposure mode is the default settings, but I think it is point metering not matrix metering..
Upvotes: 2
Views: 1496
Reputation: 583
Quite so: at least on the three iDevices I have available for development (iPhone 4S, iPad 3, iPod touch 4G), the camera starts up in "pattern" metering mode (a.k.a. matrix mode). If I then set an exposure point of interest and set exposure mode to continuous as described in the AVFoundation docs, the camera switches to spot metering.
You can check this out yourself; in the willOutputSampleBuffer
call, fetch the EXIF data and look at the Metering Mode:
NSDictionary* dict = (__bridge NSDictionary*) CMGetAttachment(sampleBuffer,
kCGImagePropertyExifDictionary, NULL);
...
int meterMode =
[[dict objectForKey:(id)kCGImagePropertyExifMeteringMode] integerValue];
(Google "EXIF MeteringMode" for what the numbers mean.)
The only way I've found to reset the camera to matrix mode, short of shutting down the app, is to programmatically reset the p.o.i. to exactly {0.5,0.5}:
CGPoint poi;
poi.x = poi.y = 0.5;
if ([inputCamera lockForConfiguration:nil]) {
inputCamera.exposurePointOfInterest = poi;
inputCamera.exposureMode = AVCaptureExposureModeContinuousAutoExposure;
[inputCamera unlockForConfiguration];
}
Any other value for the p.o.i. triggers spot mode.
Upvotes: 3