Raw RGB (in DNG) and hidden exposure compensation

Hello,


I am currently working on the rear camera sensor of an iPhone and I have noticed a strange behavior with exposure settings and raw RGB data (in DNG). The same problem occurs with both iPhone 6S and iPhone 7 on iOS 10.0.1 and Xcode 8.


I made two experiments :

- In the first, I set manual shutter speed and manual ISO (with setExposureModeCustomWithDuration:ISO: ) and sometimes the luminosity of the picture changes (which should not occur as exposure parameters are fixed)

- In the second, I want to check the linearity of raw RGB according to ISO (exposure duration is blocked). At the begining everything is almost perfectly linear but when I increase ISO to a certain value, raw RGB do not change (though they are far from being saturated) while in photos the luminous shifts are present as expected. I have found out that this information is stored in the DNG EXIF data in the Baseline Exposure (BLE) tag. When I correct those RGB with this exposure shift (using 2^BLE, the formula that I believe to be correct), I lose the linearity between RGB and ISO, which is a big problem for me. In addition to this, the tone curve in DNG file is perfectly linear which I believe is wrong in the latter case.


I believe that the two problems are correlated and that in both cases the camera does a hidden exposure compensation. Is there a way to block this behavior and if not, will it be possible to know what is happening in the sensor?



Best regards,

Dear ColorGrail,

1. To apply BLE properly, try using the formula SQRT(2^BLE). I believe the BLE reports a hardware gain (in EV units) applied to all pixels (R, G and B) straight off of the Image Sensor (Focal Plane Array) independent of the ISO value.

2. I too have noted the change in luminence when all relevant parameters are fixed. There is some sort of additional AGC going on that we the developers apparently aren't privvy too. I have also noted this with the 8MP cameras in iPhone 6 models running iOS 9. There is also (I believe) a white balance adjustment close to the hardware that the redGain greenGain blueGain read-back values do not account for, kicking in for dark pixels. This all appears to be happening in the 16-bit RAW pre-gamma domain. This is just what I've observed...maddening. Apple sure doesn't make it easy to get linear photometric data from the camera!

-WW

Hello guys,

Any luck here?

I am also working with raw DNG files I have captured with iphone 11 and iphone 12 ( I used Moment app to capture raw - not proraw). I want to check the linearity of raw RGB according to ISO. It is (almost) linear up to ISO of around 200. Apparently there is a Baseline Exposure and also a Exposure Bias (or Exposure Compensation) tag available in the DNG.

I correct the linear values based on 2^(baselineExposure+exposureCompensation) and it still does not fix my linearity issue.

The best fit (very strange) I could get to my data was 2^baselineExposure * 2^(-10*exposureCompensation).

Anybody knows how to interpret those tags?

Thanks, Hamid

Raw RGB (in DNG) and hidden exposure compensation
 
 
Q