Add new comment

White Balance in Digital Cameras: Problems

Current digital cameras provide the photographer with what is considered to be excellent means for instant diagnostics of an image right after the shot is taken.

  1. We can evaluate the shot on the LCD screen.
  2. The camera is nice enough to display a histogram (luminosity histogram and for many high quality cameras, per channel histograms as well).
  3. Finally, the camera can display zones of clipping for both under and overexposed parts of the image.

It is the popular opinion that these means of diagnostics are very good and really allow the photographer to evaluate exposure errors such as under- and over-exposure, among others. Of course these are all common misconceptions.

  • The single channel histogram is calculated based on the luminosity formula that represents a linear combination of the values of R, G, and B channels after gamma-correction; while the total weights of R and B channels are only of about 20%. And that is the best case scenario, because for some cameras this histogram in fact represents only the G-channel, ignoring the other two. Such a histogram not only can't help the exposure evaluation, but in many cases is extremely misleading.
  • All other means of diagnostics like per channel histograms, blinkers, and the image itself displayed on the LCD on the back of the camera, are displayed after the white balance is applied (it might be worth mentioning, that all the settings in camera distort the histogram; this includes contrast, brightness, saturation, sharpening, and tonal curve, often referred to as gamma-conversion. This happens because the histogram is derived from the JPEG preview and represents the rendered data more than the actual raw data captured.)

Let's illustrate the above statement, referring to the white balance. Here we have three sequential shots of the corner of my room lit by a lamp that has 5000K CCT. These shots are taken with different white balance settings, 10000K, Auto WB, and Incandescent. As we see, both histograms and the general appearance of the image are vastly different, however the raw data captured in all three shots practically identical, as far as that is possible, given that the shots are hand-held.

This unfortunate trait of digital cameras devalues those built-in diagnostic tools if we do not program the camera in a very particular way, as it will be shown below. Let us first note that everything described below has no bearing to photographers who shoot JPEGs, for their case, the camera displays the final result and the histogram, preview, and overexposure are all real, everything that is cut off is already truncated in the JPEG conversion. The following text is for you if you shoot raw and if you try to use your camera to the most of its capabilities.

All camera histograms below result from Canon 1D mk III with standard settings for contrast and color space set to Adobe RGB.

The Theory: Spectral Sensitivity of Sensors

Let's have a look at the curves of the spectral sensitivity of a sensor found in a modern digital camera. Those curves are not published by many, but one can find some for Kodak, Dalsa, and even Sony sensors. On this illustration you can see the curves for the quantum efficiency, taken from the data sheet for Kodak KAF-10500 found in Leica M8 cameras. Sensors for different cameras have different curves of this type because such curves depend on the semi-conductor properties of the particular sensor, as well as the spectral characteristics of the Bayer filter used.

Suppose we are shooting a gray card under some fixed lighting conditions. Per channel response will be the product of the spectral response of the light source and the spectral sensitivity of the particular channel (to be precise, it's an integral taken on the wavelength from blue to red).

The Tool: Rawnalyze

To get images without the white balance compensation, the most widely used tool is dcraw -r 1 1 1 1. However, the resulting pixel values will be scaled thus making the image harder to evaluate.

Rawnalyze is a much better tool for the job. It allows one to look into the unmodified raw data, builds a histogram, allows to play with white balance, etc. The histogram display is not perfect, having the linear scale on the X-axis; it is also unknown how the black point is applied, if it is applied at all, but as of the time of writing, this is the best tool available.

Rawnalyze can crash while executing certain commands, like selection. This can be cured if the program window is maximized. The author is aware of the problem and it looks like the last versions of Rawnalyze do not exhibit such behavior.

Besides Rawnalyze, the photos of the histograms on the back of the cameras will also be used, because it is the only information that is available at the time of shooting

The Practice: White Balance for Daylight

The simplest way to evaluate the real scope of the problem is to shoot a gray card, or just a white piece of paper, which does not contain an optical brightener, using sun as the light source, and then evaluate the histograms. Setting exposure correction to +2 eV (that is exposing the gray card for the third zone instead of the fifth), and using Auto WB, we will see a histogram similar to the one shown on the left.

Everything is as expected, narrow peaks appear to be exactly balanced in each of the channels. The camera suggested that the color temperature is 5200K which looks normal for a Moscow spring early afternoon and dusty air. The histogram displayed by Adobe ACR or any other standard converter looks just the same as this one.

The peaks on the histogram are not ideally sharp and narrow, because there is some brightness variation across the field, due to some lighting variations caused by the reflections from the walls, the ceiling, and other subjects in the room; the lens, although very good (Canon 85/1.8 at f/8) still vignettes; the camera body itself also vignettes: the sharper is the angle of the incidence of the light beams hitting the sensor, the lower is the response of the sensor, and it is well known that this angle becomes sharper towards the edges of the frame.

Now let's have a look at the real data, uncooked raw. It is very obvious that the best exposed channel is the green one, while the worst exposed is the red. The blue channel is somewhere in between. It is important to mention how different this histogram is from the histograms displayed by the camera itself, and by the raw converters. They are taking care of this error for us.

More Practice: The Detailed Description of the Problem

We have two problems, right with the broad daylight:

  1. The poor exposure of the red channel as compared to the green and, to less extent, the exposure problem with the blue channel.
  2. Clipping of the green channel, which the camera will give no warning of.

Both problems can be easily illustrated - as with the digital cameras one doesn't need to wait for lab processing.

Noise in the Red Channel

Let's take an image of the same sheet of paper, applying -3 eV from the middle grade. Thus we get into the beginning of shadow values. Next, let's stretch the channels a little bit, the same way we do it when we extract details from shadows. Looking at the channel planes at 100%, pixel level, we can easily see that the red channel is much noisier than the green, and that is even before applying any sharpening. There is nothing really strange here, because the red channel is underexposed by three stops, not by two, as the green one. Of course, to make the difference more pronounced, a strong dose of post processing was applied, however, if the red channel is weaker than we had it here, the difference will be even more drastic.

Noise level depends on raw converter used, interpolation mode and so on.

Unfortunately, there is no easy way to cope with this problem. The sensitivity of the channels could be balanced either by a filter on the lens (for this particular camera model it would be magenta CC30M), or with the same filter on the light source (flashgun). However, this can be done only if the light is strong enough. The results with the filter discussed in the next article.

Clipping that Camera Fails to Warn About

Because the camera fixes the histogram, it is highly possible that in some situations, one channel clips, while the camera histogram fails to show it. As a matter of fact, if you're shooting, setting the exposure in such a way that the histogram comes close to the right wall (ETTR, exposed to the right) the clipping will occur more as a routine rather than as an exception. Here the image shows a very typical cityscape lit by the sun coming from a side. Now, looking at the photo of the camera LCD, we can say that the histogram seems fine and there is no overexposure.

Unfortunately, the green channel is clipped, while the red channel is one stop underexposed, as you can see it on the histogram of the raw data.

If the white balance is intentionally changed, or if the contrast setting is changed, then the histogram displayed on the back of the camera will change too, as we discussed earlier, however the raw data captured will be absolutely the same.

So we are coming to the conclusion that even per channel camera histogram does not provide us with trustworthy information about under- or over-exposure of the channels. In one of the next articles we will try to show how to tune the camera to avoid this kind of misinformation.

The Cooler Lighting

If the lighting is cooler, nothing really changes. From the point of view of the camera, the blue channel is more exposed, as you can see it on the image, however, the level of details is less than that of the green channel. If the white balance of the camera is set to the real value of the light color temperature and not to the Auto (or as many often do it, to daylight), then the readings on the camera LCD will deviate from the reality even more. Wider peaks on the histograms compared to the shot taken at daylight are because with the artificial it was more difficult to achieve the evenness of the light across the target, than it was with the sun.

Once again we can see the that the statement holds true: histogram displayed on the back of the camera differs greatly from the real histogram of raw data.

Incandescent Light

If the light is provided by the bulbs, the behavior changes to the opposite: the camera can give a false alarm of an overexposure. This time, the model was a red doll on a white stool. The source of light was a 60 Watt incandescent bulb; the camera evaluated its color temperature as 3200K, while Adobe ACR suggested 2800K. The camera histogram was of a very strong overexposure. Please note two things, first, the exposure correction was set to +2, second, the black halo around the doll - those is the blinker, the area that the camera considered to be overexposed.

The real raw histogram shows no sign of overexposure. And even more, there is a headroom of about half a stop in spite the fact that we already applied a +2 eV exposure correction in the camera.

It is now pretty obvious that one of the reasons of the constant bad quality of the images taken under artificial light is the banal underexposure resulting from the blind trust in histograms as they are displayed on the back of the cameras. If the shot is exposed as it is recommended by the camera, it turns underexposed by more than 2 stops, resulting in a noisy, poorly detailed image.

Conspiracy Theory

The spectral sensitivity of the sensor is established at the design time. The manufacturers of the cameras are forced to set the per channel sensitivity in such a way that the resulting images will be acceptable under both daylight and incandescent bulbs. From this point of view, the high sensitivity of the green light channel is a forced trade-off, allowing to get a reasonable color of the human face, under artificial lighting (the green is the auxiliary color, not generally present in the faces, but it is the closest to luminosity, and if it is underexposed, the noise will prevail). A knowledgeable photographer should correct for this, shooting in the daylight. Camera preview, ideally, is supposed to show the shot after the white balance is applied, especially taking into the account, such modes as print right from the camera, or print all selected from the compact flash card.

The situation with the histograms is much more complicated. Of course it is desirable and sensible when the histogram on the camera and the histogram displayed by the raw converter are similar, however the photographer should be informed of the real state of matters in the raw file. It well may be that those photographers interested in the real state of matters are very few, and they can use an easy way to cut the corner, and to trick the histogram display, forcing the camera to show a histogram which is much closer to the reality. Thus, the camera manufacturers have chosen the way that most of the users can appreciate.

What to Do Next

Once again, we have two problems:

  1. The tooles used in the camera for under- an over-exposure diagnostics are taking into account the setting of the white balance, which is completely wrong in the case of shooting raw.
  2. The sensitivities of the channels are unbalanced, which results in the excessive noise in the weaker channels.

The first problem can easily be cured with camera settings. The trick is to set the per channel white balance coefficients all close to 1. This is known as setting white balance to UniWB. We will describe how to set UniWB into the camera in the next article.

The second problem can be cured either by a color correction filter on the lens or by a similar filter on the light source. We demonstrate the benefits of this approach for daylight shooting in the separate article.