I use AVFoundation to take photos. Trouble is that even with constant settings of exposure duration, ISO and white balance I get photos with different brightness. Torch, flash and all possible stabilizations are disabled.
This issue is also presented in standard Apple app introducing working with camera: https://developer.apple.com/library/ios/samplecode/AVCam/Introduction/Intro.html#//apple_ref/doc/uid/DTS40010112
This is the video I filmed via this app containing no changes except setting manual exposure during session initialization:
https://www.youtube.com/watch?v=g9NOWGVeftI
Notice the sudden brightening what should not be if exposure settings of digital camera are constant (no, it is not moment when exposure settings have been set and completion handler has been called; settings are already set).
The brightening happens not always but anyway there can be significant brightness difference if I move camera away and aim to object again. But if I make series of photo without moving camera the brightnesses are same.
(Of course, object’s photos are taken in the same light circumstances)
May be this brightening is a part of setting custom exposure settings (because it usually happens at first) and lt’s late activation is process I should speed up but I don’t know how to do it.
I have this effect on iPod Touch 5 & iPad Air. I suppose it can happen on other iOS devices too.
It seems that scene brightness affects final image brightness (and preview layer’s brightness too). Device doesn’t just set given exposure settings; it adds some correction based on current scene brightness and changes this correction when common brightness of visible scene is changed a lot.
If I close camera by my hand, move hand away and take a photo it can be brighter than one that captured without closing camera before.
May be it’s not [only] brightness but contrast because when I move camera away from white display there can be brightening in moment when [relatively dark] objects beyond screen became visible.
Exposure target offset is little less than zero before the brightening and little more than zero after brightening.
I supposed this value is parameter on what this unexpected adjustment is based (as in auto exposure mode).
But attempts to prevent it via observing changes of target offset and setting equal exposure target bias failed because target offset is being changed all the time and it’s impossible to have working camera changing it’s target bias permanently.
Attempts to force adjustment via setting exposure target bias making exposure target offset value far from zero before capturing failed too because nothing happens and I can have the brightening after attempt to compensate. Even in custom mode target bias affects exposure offset [visible to client] but it seems it does not affect device behavior in parts responsible for exposure.
I also found that there are no brightness jumps in locked exposure mode (or I missed them…). I tried to set this mode after setting custom exposure values but trouble is that in locked mode device not only fixes current exposure values but does initial adjustment what changes exposure settings.
Exposure values I get from exif data and from AVCaptureDevice instance after taking photos are not changed after jump. I tried to observe exposure values via KVO but there’s nothing suspicious. When I set custom mode exposure duration and ISO are being changed few times and then completion handler is called. The brightening can be later, but it doesn’t affect current exposure values I can get.
All it is confusing. How can I provide straightforward relationship between image’s brightness and exposure settings?