Histograms, Exposure and Dynamic Range

In our previous tutorial about Exposure we discussed the use of the Camera Histogram to check if the picture is properly exposed, in this tutorial we are going to talk a little more in detail about histograms and what they meand and we are going to introduce the concept of Dynamic Range which is really important in digital pictures. The purpose of this tutorial is to understand histograms in detail, to understand what dynamic range is and means and to use those concepts to refine our knowledge about exposure.

Histograms

There are two types of histograms that are used in digital cameras: RGB histograms and luminance histograms, some cameras use one type and some cameras use the other and in some models you can choose which histogram type to use.

RGB Histograms

The RGB model represents pixels indicating the value of red, green and blue contained in the picture. When the maximum level of both red, blue and green is found you have white, when the three colors measure zero you have black. In a RGB histogram the camera plots for each channel the number of pixels corresponding to each level, from zero in the left extreme of the histogram to maximum in the right side of the histogram. Then the three channels are plotted at the same time in the histogram.

This type of histogram is good to understand how colors are represented in the picture but is not very good to judge exposure because if you have pixels that are completely red, blue or green in your picture they will appear as peaks on the right side of the histogram when they are not overexposed areas in the picture just too red, too blue or too green. So RGB histograms should be carefully analyzed when your image contains very bright and vivid colors and specially when the image contains pure representations of these three colors.

Luminance Histograms

In a Luminance histogram the luminance of each pixel is computed as an average of the green, red and blue channels. Since the human eye is more sensitive to the green color the average is computed as 59% of the value for the green color, 30% of the value for the red color and 11% of the value for the blue color. The result is then plotted in the histogram as an indication of how bright the pixel is. In general luminance histograms are better to judge the exposure of a picture than RGB histograms and RGB histograms are better to determine the color clipping and ranges in the picture.

Dynamic Range

The X-Axis of the histogram represents the brightness of the pixel and the Y-Axis represents the number of pixels that have that brightness. The X-Axis then is what we call the "dynamic range" of the camera meaning the number of different brightness levels that can be computed. Anything darker than the darkest level that the camera can capture will appear completely dark in the picture regardless of its true color and will be labeled "underexposed". Any pixel brighter than the maximum brightness in the dynamic range will appear completely white and will be "overexposed" or "burned" in the picture.

Digital cameras as well as SLRs have usually a dynamic range of 5 f-stops being each f-stop half the brightness of the previous one. This is why some histograms are divided in five columns or zones. The total number of "brightness levels" that can be captured is generally 4096 (12 bits per pixels) but this doesn't mean that each f-stop has 4096/5 brightness levels. Because each f-stop is halves the brightness of the previous one the number of "tones" in each f-stop is also halved. The brightest f-stop that the camera can sense will have half the tones: 2048, the next f-stop will have 1024 and so on:

First f-stop: 2048 levels.
2nd f-stop: 1024 levels.
3rd f-stop: 512 levels.
4th f-stop: 256 levels.
5th f-stop: 128 levels.

So there are more "levels" for the brightest tones in the picture than for the darkest tones. This is why very dark pictures with many shadows or dark backgrounds tend to look posterized when printed because the number of tones in the camera sensor for the dark colors is not enough to match the picture range.

Exposure Revisited

The real world is generally represented in 10 f-stops from the minimum level of light that can be used to see barely something to the full reflection of the sun in a white surface. So a scene can have up to 10 f-stops of range or less. When the scene has 5 stops or less you can expose it perfectly with your camera but when the dynamic range of the scene is greater than the range of the camera you will be forced to either underexpose or overexpose some pixels. To solve this problem there are some solutions that can be used.

The first solution can be used when the foreground is too dark and underexposed for a properly exposed background, you can then reduce the dynamic range of the scene illuminating the foreground with your camera flash. Some trials about the proper flash compensation to be used might be needed.

A second solution is to use a natural density filter for the image, the filter will reduce the brightness of some areas thus reducing the range of the scene, for some landscapes this has a good effect and in some other situations it just doesn't.

The final solution is not to change the dynamic range of the scene and use bracketing to take the same scene with different exposure levels and then digitally blend the exposures to get a picture where everything is perfectly exposed. This technique captures the complete range in the scene but requires some work with your photo edition software to combine the exposures. The auto-bracketing feature in some cameras can be used to automatically take 3 pictures with different exposure levels. Make sure that the overexposed shot has all the dark areas perfectly represented and that the underexposed shot has all the bright areas within the camera range.

Exposing to the right for RAW pictures

As we have mentioned the camera has more levels for the bright tones than for the darker ones so if you are shooting in RAW mode where the image is stored as-is seen by the sensor without any processing then you should try to sligthly overexpose your pictures trying to put as many pixels in the right side of the histogram as you can. Of course you have to avoid "blinkies" or pixels that overflow the histogram and are burned but the maximum exposure that can be used without any blikies is your goal.

So try increasing the exposure until you can't increase it more or some pixels will be overexposed and take the picture without worrying about the result. Then adjust the brightness and contrast with your photo editing software, in this way you will be using the maxmimum number of total colors you can for the picture and this is the way to avoid any pixelation or posterization in the final result. This is an important trick for professionally looking pictures.

If your camera doesn't have a RAW mode this is not necesary because the JPG picture is already processed by the camera, compressed and represented in a 8-bit model.