Chasing a Gray Cat In a Gray Room: the level of middle gray and the headroom in the highlights for Canon 5D Mark II

The current methods used to determine the sensitivity of digital cameras are not based on the RAW data coming from the sensor; rather they are based on the results of processing the RAW in a converter (be it an external converter or in-camera).

This approach, with all its simplicity, is in fact based on the properties of the RAW converter and on the transformations it applies to RAW data. In particular, the converter can introduce hidden exposure compensation, change the tone curve, and so on. The sensitivity of the camera resulting from such a procedure is a pretty arbitrary value. The matter is discussed in good detail in Wikipedia, in the article explaining ISO 12232 standard.

This approach allows the camera manufacturers to enjoy all sorts of tricks while stating the sensitivity, say cameras from different manufacturers but having the same rated sensitivity behave wildly different when it comes to photographic latitude. This means that switching between different camera bodies one often needs to re-adapt, changing the way he applies exposure compensation.

A simple experiment that takes no additional equipment other than already existing camera and lens allows to accurately determine how the camera exposes, that is:

  • which level of signal (in terms of RAW data) is obtained while setting the exposure by the exposure meter;
  • what headroom in highlights is left, i.e. how many exposure stops are between the middle gray and sensor saturation.

(Micro) theory of exposure metering

When measuring exposure by the light reflected from the object we rely on the fact that if we set the exposure based on the measurement it will be printed as a middle gray tone.

Exposure meter calibration constants are different for different manufacturers. Some manufacturers of exposure meters and cameras (including Canon, Nikon, Sekonic) maintain that the middle gray tone is approximately 3.15 EV lower than the highlights in the scene, while others (Pentax, Minolta, Kenko) consider the middle grey tone to be lighter by about 0.4EV. More information about exposure meter calibration constants can be found in Wikipedia.

However, it is customary to print the middle gray as 18% of gray, thus the first group of manufacturers of photo equipment implies that the range between the middle gray and highlights will be compressed by about 0.7EV, while the second suggest compression by about 0.3EV.

Of course, the real scenes are all different, so while shooting film a photographer must visualize what happens when the subject is exposed in accordance to exposure meter reading; that is, what will be the relationship between the density of the subject and true , 18% midtone after the shot will be processed and printed according to the standard procedure.

About the same understanding is necessary with digital photography, but of course we need to take into account certain digital features:

  • If shooting in RAW multiple "developers" (RAW converters) can be used, each of those can be tried with different settings.
  • In contrary to the classic film, digital sensor does not tolerate overexposure at all; if the RAW data reached saturation level, the highlights can be salvaged only through additional interpolation from those color channels are not yet fully saturated. Such interpolation is very lossy for anything but surfaces that are purely neutral in color.
  • The sensitivity of the different color channels of the sensor differ as much as 1 - 1.5 stops and even more.
  • The character of highlights, midtones and shadows of the digital media is also different from the film: the highest resolution and lowest noise is achieved in the highlight, while the deeper are the shadows the higher is the relative level of noise.

But it turns out that as soon as we know at what RAW level is the middle gray tone recorded when shooting in accordance with the exposure meter, and we will have a lot of useful information about the camera.

Methods of measurement and discussion


The technique of shooting is very simple and does not require any special equipment except the camera and the lens itself.

The suggested technique of determining the sensitivity through the placement of the standard middle gray is based on shooting just a gray card which fills the entire frame. The card can be pretty much any shade of gray, but it should be a uniform shade. You can take a sheet of white paper or cardboard, better without optical whitener.

For this test we want to keep lens vignetting to a bare minimum so a telephoto lens stopped down is a good choice. We used a Canon 135 / 2 lens stopped down to f / 8. Yet another reason to use a telephoto lens is to get rid of the effect digital vignetting caused by increasingly oblique angle of incidence of rays hitting the peripheral areas of the sensor: the further is the sensel located from the center the more oblique is the angle and at certain point this causes the decrease in the efficiency of the sensel.

We shot the target with the strongly de-focused lens so that the target texture and particles of dust have negligible effect.

The exposure parameters were set exactly according to camera exposure meter; to set the exposure automatically we use aperture-priority mode.


The target should be evenly lit. This is easily achieved, for example, by illuminating it with the diffused light from the window.

It should be realized that the results depend on the type of light: for the daylight the response in the green channel is 2-3 times (1-1.5 stops) higher than the response in the red channel, while in the light from incandescent lamps (which are much wormer than daylight light, meaning they emit more red) the response in green and red channels is almost equal.

Data processing

We are interested in two sets of data:

  1. The value of the response determined from the RAW data for each channel individually.
  2. The values recorded in the out-of-camera (OOC) JPEG (since we are using automatic white balance there should be nearly no difference in the values of individual RGB channels recorded in OOC JPEG).

To extract the RAW data we used our 4channels program from LibRaw 0.7-Beta3 distribution. The assessment of the middle gray tone was done over the central portion of the image (the central third in the linear coordinates, which is 1 / 9th of the sensor surface). We used an additional program to determine the averaged values.

The reading from the OOC JPEG were assessed using Photoshop CS4: the central part of the image was blurred with Gaussian Blur setting the radius of 250, and then the readings were taken with the picker of the size of 101x101 pixels.


Presentation of the results

The values obtained in the experiment can be presented in different ways. It seems that the most revealing is to present those results in the form of the 'Headroom' the distance in EV stops from the middle gray to full sensor saturation where the highlights are blown out. This figure shows how much reserve we have to the extreme recorded highlights if the exposure is set according to the camera meter.

RAW data is essentially linear, so the "headroom" can be calculated using a very simple formula H = log2(Ls / Lg), where Ls is the level of white (saturation), Lg is the reading for gray. Because of different sensitivity of the color channels, the per channel headroom value will vary.

For JPEG data the formula is more complicated, because of the nonlinearity: H = log2((255/Lg)**g), here g is the value of gamma for RGB-space of the JPEG (for AdobeRGB g = 2.2), and 255 is the level of saturation for 8-bit JPEG data.

While generating the JPEG the camera aligns the per channel signals, applying the white balance, so the amount of headroom for channels will be virtually identical.

Assuming that while creating OOC JPEG no excessive clipping of highlights occurs (which, of course, is not true for all camera modes and requires further study), the difference between the headroom in RAW and in JPEG indicates how the camera performs highlight compression.

Measuring the level of saturation

To measure the level of saturation we took a grossly overexposed shot and determined the maximum per channel level. If all the channels are saturated and the camera is of a conventional design (not like Nikon D3) these saturation values will be identical for all image pixels. For the camera we are testing it is indeed so. After subtracting the black level we got the following figures for the saturation level:

  • 14,739 for the sensitivities of ISO 50 to ISO 3200;
  • 15,349 for sensitivities of ISO 6400 and above.

Results for the spot-metering mode

Results for the spot-metering mode are presented in the chart. On the horizontal axis we graph the sensitivity; on the vertical - the headroom for RAW color channels and out of camera JPEG (click on graph to see enlarged copy in separate window).

On this graph we can observe the following interesting effects:

  • For all of sensitivities in the range of ISO 100 ISO - 25600 the green channel is exposed 3.65-3.85 stops lower than the level of saturation. In other words, the gray card is exposed to the level of 7.5% of the maximum.
  • In-camera RAW converter raises the level of gray about 1.1 stops (up to the level of 16%), i.e. approximately to the value where we expect the midtones to fall for the presentation on a screen or in print. Hence the highlights are quite compressed.
  • The headroom in the blue and, notably, in the red channel is significantly higher. The headroom here is greater by 0.5 and 1.3 EV, respectively. This means that for the daylight highlight recovery process has a good chance to restore highlight neutrals which are 4 to 5 stops brighter than the middle gray. The price for this convenience is stronger noise in the red and the blue channels, mostly affecting shadows. Blue sky is one of the important examples of shadows for the red channel.
  • ISO 50 is actually ISO 100 overexposed one stop. The in-camera RAW converter takes this into account and compresses highlight for ISO 50 only to 0.2 EV.

Matrix metering

The results for the matrix metering (A.K.A. evaluative metering) are presented on the next chart.

As we can see, relative to the spot metering matrix metering constantly exposes lower by 0.1 EV. The reasons for this are not clear: the measurement was carried out over smooth and evenly illuminated surface, and should not present a sustained deviation in one direction. One of the possible reasons might be the built-in vignetting compensation for the lens. However 135 / 2 we used for this experiment has practically zero vignetting over the measured surface. It is possible that the measurement procedure was designed for a less outstanding lens, and it overcompensates in our case. This issue needs to be addressed in a separate study.

The compression of highlights as performed with in-camera RAW-converter is also 0.15 EV lower compared to the spot metering. As a result the middle gray is 1/4 EV lower than in the previous.

The other measurement modes available in the camera render results in between those from evaluative and spot metering: the results for center-waited mode are very close to results from evaluative metering while the 8% mode is close to spot metering.

Highlight Priority Mode

In the Highlight priority mode (D +) the results differ significantly from the standard mode (note that the vertical axis on this graph had to be extended 1EV up).

This mode is 1 EV underexposure, which is then compensated by the in-camera RAW-converter and the resulting placement of the middle gray in JPEG virtually does not change. Thus, in this mode we have the headroom in the highlights ranging from 4.7 stops (for the green channel) to 6-6.25 stops (for the red channel). This headroom is subsequently compressed during the conversion to the regular 2.7-3 stops.

Photographic conclusions

All the following only applies to shooting in RAW. If you shoot JPEGs camera manufacturers have already decided for you, and it is very difficult to override in post-processing what is already done while converting to JPEG in the camera.

Special modes

ISO 50 is 1 stop overexposure, based on ISO 100. Highlight priority mode is 1 stop underexposure, based on ISO 100 -ISO 3200. However the wheel that controls exposure compensation is more conveniently located than the controls that trigger the two above mentioned modes. Because of that we do not see any reason to use those modes.

Using the camera LCD

Using camera LCD screen to evaluate the image (or histogram), it is necessary to realize that you are looking at OOC JPEG and at the histogram derived from it, not at the RAW data in fact nothing close to it. The white balance and the middle gray correction are already applied to it as discussed above, and while one can override white balance application using UniWB, there are no convenient ways to override the bump in middle gray and highlight compression (owners of Nikon cameras can load a special in-camera curve to correct the middle gray placement to their likings; with other cameras one can play with low-contrast settings to try to lower the middle gray bump). Without the correcting of the middle gray placement the in-camera converter presents us with an image and histogram featuring overstretched shadows and tightly compressed highlights. This effect makes it increasingly difficult to asses the shot correctly judging it by the presentation on the in-camera LCD.

Hidden correction in the middle gray level in RAW converters

Many RAW-converters apply correction to the middle gray level so that if the shot is exposed according to the exposure meter (which is 7.5% of the saturation level for the discussed camera), it will be brought to the standard middle gray of 15-18% necessary for display and printing. This will happen even when all the RAW converter controls are in default neutral position.

This means that behind the scenes the RAW converter adjusts the placement of the middle gray by approximately 1 EV. To get closer to the truth it is necessary to manually apply -1 EV to the standard value. In other words, a correctly exposed shot that places the middle gray not to the arbitrary level decided by the camera manufacturer but to the standard zone V 18% gray will most of the cases look overexposed and blown out when in fact it is not.

The effect of lighting

If we start changing lighting from the daylight (which was used for the above experiments) towards incandescent, the change in spectral composition of the light will be balanced by the existing difference in the sensitivities of the color channels of the sensor. For the incandescent lamps the sensitivities of the green and red channels become nearly equal while blue is strongly lagging behind and thus the headroom in highlights is further increased. At the same time the scenes lit by incandescent light are usually not very contrasty and such headroom is excessive. In other words, while shooting indoors under incandescent lamps strong underexposure is a given if we follow the advise of the exposure meter. Of course, RAW-converter will take care of the compensation for us ....

What is the sensitivity of the sensor?

In the absence of clear standards (while existing standards suggest to use in-camera JPEG rendition, that is to set the sensitivity based on RAW developer), there is no clear photographic answer to this question.

However, understanding of the placement of the middle gray tone while setting the exposure according to the stated sensitivity of the camera has a very practical application. Let's consider a couple of examples:

  • If we set the exposure for the middle gray tone the RAW data representing the region from which we metered will be around 7.5% of the saturation for the green channel (and 1.5-2 times lower for the blue and red channels). If the contrast between the midtones and the highlight of the scene is less than 1:12, we can increase the exposure, thus reducing noise.
  • If we expose for the highlight (like we often do it with reversal film), we meter from the brightest regions of the scenes where we want to preserve some texture and add positive exposure compensation. Such compensation for the camera we test here ranges from 3 2/3 EV (if we do not want to allow clipping in any of the channels) to 5-5.5 EV if we dare to rely on the highlight recovery in the RAW converter to get back the details in the color-neutral texture we metered from.

The most beneficial method of exposure (from the point of obtaining the best image - without unnecessary clippings in the highlights, and without underexposure) is the second one. We sure do not lose details in highlights and in doing so we are exposing to the right , as far to the right as possible.

Yes, it is kind of ETTR, but "regular ETTR" implies control by assessing the histogram or the image, while just above we discussed why histogram and preview are unreliable and why the visual control is inaccurate.

It should be noted that reducing the difference in sensitivities of the channels (for example, using magenta filter for outdoor scenes), we simultaneously achieve two things:

  • reduction of the noise level in the red channel and (to a lesser extent) the blue channel;
  • reduction of the headroom in the highlights in the red and blue channels, the headroom that works for us allowing the recovery of highlights in raw converter.

In general, probably it is easier to deal with the balanced sensitive materials, but it of course depends on the situation.

Know your camera

The headroom in the highlights and per-channel sensitivities are vastly different for different manufacturers and camera models, and even one manufacturer can set those differently for two cameras released nearly at the same time (for example, Canon 450D exhibits the headroom in highlights half a stop lower than 5D Mark II, while both of these cameras sport 14-bit ADC and were launched during less than one year interval). As a consequence, measurement of the placement of the middle gray should be accomplished for each individual camera. The good part is that the measurement is easy to do and does not take much time.

It is important to conduct the measurements similar to those described above not only for the sunlight but also for other different sources of light. Furthermore, if we are going to use filter to balance per channel sensitivities, it makes very good sense to repeat the measurements with such filters as well.

P.S. Yes, and by the way, if you see distinct shoulders in highlights present on the graphs it is some RAW converter that took care of moving the middle gray and compressing highlights. Have another look at DPReview tests.


Lens Aperture cheating

I think many manufacturier are doing that but I had only the Fuji X-pro2 to test it:
Thanks to you library and the useful plugin for python I have computed gain of my detector using the photon transfert curve method, very simply.
I found of course that the gain increase with ISO as expected.
But also I checked something, the gain increase when you use a high aperture (in this case this is a 56mm f/1.2) on a lens which can communicate with the body.
Compare with the f/2.8 and above (don't know yet where the transition is) there is a factor 1.4 in the gain.
Measurement here :

This is due to the fact that at high aperture, the 'extra' light rays coming from the outer border of the pupil are hitting the pixel with a bigger angle. Pixel have a lower tolerance in angle, so what the manufacturers does is cheating the gain/ISO relation so the user is happy to see the expected extra stop of light which does not exists.

Well all this to illustrate the tricks of camera makers to be able to sell f/1.2 lenses (well you still get the bokeh) and the use of your library.

Add new comment