iOS + AVFoundation. Different photo brightness with the same manual exposure settings

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 conditions)


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).


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 (as it should according to documentation) 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?

I am experiencing the same exact issue. Would really appreciate some guidance on this.

>But if I make series of photo without moving camera the brightnesses are same.


Because those tightly sequenced images are being pulled from the buffer, which captures and releases frames that exist in time just prior to the user tapping the button/icon. This tactic reduces motion induced image shaking as the user moves to take a photo. "Wow! Look, perfect! I thought I moved...?? Man, this is a great phone! How do they do that?"


Taking an image, then moving away, then moving back, results in a different enough realized spectrum that some changed attributes, and how those are applied, are nearly guaranteed.


Remember, the cameras on Apple's devices are strictly consumer grade and designed for making the user happy. A professional photographer needs to adjust expectations accordingly, or risk confusion, etc.

My development team is experiencing the same issue. My lead developer is going to post this as a separate thread.


When you cover the lens of the iPhone before launching preview/live view, the image is lighter.

If there is ambient light present when launching preview/live view, the image is darker.


Metadata for both images is the same, but one is noticeably darker.

Clearly, iOS is still making some exposure determinations, even though we are manually setting ISO, Shutter, Color Temp, and Tint.

iOS + AVFoundation. Different photo brightness with the same manual exposure settings
 
 
Q