Tuesday, November 22, 2011

Histogram

Understanding the histogram of an image is an essential precondition to master digital photography both at the time you shoot your image as well as during post-processing in your imaging application.

There's no big magic behind it - the histogram is a distribution curve showing the intensity of a tone in relation to its luminosity value. The left hand side of the histogram shows the dark tonal range usually referred to as "shadows", the center portion is covered by the "mid tones" and the right hand side shows the bright tonal range or "highlights".


The above histogram is based on the complete RGB color space which means that it's basically an overlay curve of the 3 base color channels (Red, Green, Blue). Your camera will usually just show you the RGB representation but in your imaging application you can usually also display the histogram for the three base colors (see also the histograms shown later on this page).

Your camera will always deliver images that reside completely within the luminosity range of the histogram. As a rough rule an average scene with both very dark as well as very bright portions should cover the complete range of the histogram. So if you check your histogram on location and the left or right side of the histogram is empty your image will be most likely under- over overexposed. 

Naturally there may be scenes that simply exceed the dynamic range of the image sensor. In this case you'll not be able to just touch the dark or bright end of the histogram curve but you'll hit the limits with high intensity - the result are blown out highlights if the histogram is pushed "beyond" the white point (the right-most point of the histogram) or plain black shadows if the black point (left-most point) is exceeded.


















The above sample shows a quite "harmonic" distribution of the histogram.






The Ends

The left end is the Shadow area and the right end is the Highlight area.

The area roughly one-third from the left to one-third from the right are the mid-tones. In this image the majority of the pixels are in the mid-tone area with a nice representation of both shadows and highlights so it is a nicely balanced image.

Tonal Range

Ideally the best image will have pixels at each level from 0 to 255 in a shape similar to this one. It really is rare to have a histogram like this and I believe out of the 1000's of images on my computer this was the only one with a nice balanced shape!

The higher each vertical band - the more pixels are present at that particular level of brightness.

At brightness level 162 on this histogram (the highest point) there are 162,643 pixels and at the left end (level 0) there are a mere 11,248 pixels. The entire image contains 23,970,816 pixels in total.

The total number of pixels and the amount of pixels at each brightness level are not important - just interesting unless of course you are some kind of math geek. What is important is the shape and where the end points are located.

Middle Gray

The metering of every digital camera light meter and every hand held light meter is standardized to set the cameras f-stop and speed based on an object that is middle gray at approximately 18% luminance. If the camera is pointed at a very dark subject the meter will assume that is 18% gray and make the settings accordingly - this is the main reason for both under exposures and over exposures so be careful when you are metering.

More Examples Of Images with Their Histograms.


















Notice how there is very less data on the Far Right and middle of the Histogram.






2 comments:

  1. Nice article! a section about histogram equalization/matching would have added to practical utility of your coverage of the concept.

    ReplyDelete
  2. Thanx for the suggestion Aditya... I plan to cover the same in a minor post processing article that would follow soon. :)
    Keep commenting and visiting for updates.
    Thanx

    ReplyDelete