step 1

The Histogram and Its Uses

Using the Histogram is one of the first steps in photo enhancement or color correction (The first is taking a good look at your photo in order to determine what it is you want to accomplish). Histogram use generally falls into one of the following categories:
  1. As an aid in obtaining better scans (see scantips.com)
  2. Determining how much to increase or decrease the brightness of an image
  3. Determining if there is enough contrast in an image
  4. Detecting and correcting exposure problems in individual color channels of an image
(It has been stated that the Histogram also tells you if there is enough information in order to perform meaningful improvement in an image. I do not ascribe to this notion. Each individual decides where such a cut off would be. Moreover, although an image may be a decidedly badly taken one, it may be all you've got!)

For this tutorial we will be primarily concerned with item two and three. Let's take a look at the Histogram of our image. (You should probably download the full size image and follow along. Just double click the image below. When the image appears if you use IE right click and choose--save picture as, in Navigator right click and choose--save image as)

Somewhere in Okinowa     Histogram of Okinowa Image


If your Histogram Window is not viewable in the Paint Shop Pro workspace select View-Toolbars-Histogram Window. The Histogram Window gives you a picture of four histogram graphs- one for each of the the color channels, and a luminance histogram that is calculated as a weighted average of information from the three color channels. Since human eyes see green best, if you look at the luminance histogram, it always seems to be closest to the green histogram. That's no accident. It's actually a consequence of the extra weight that's given to green in that weighted average.

So what does this Histogram tell us. Well, a good Histogram would be one like this one-the graphs stretch over the entire lightness range (that is to say, each Histogram graph stretches from end to end on the scale which means we have good contrast in the photo). Moreover, the graphs information isn't too heavily weighted to one side of the scale. When an image is too dark, the Histogram graphs are heavily weighted to the left. When an image is too light, the Histogram graphs are heavily weighted to the right. If you are following along with the tutorial,since the Histogram tells us we don't need to perform any brightness corrections you can go on to the next step . If you want to know more about Histograms keep reading.

What we have been calling Histograms are really Frequency Polygon or Line Graphs (a Histogram is actually a type of bar graph. I only mention this because some people out there may have had a statistics class or two). For each lightness level (there are 256 of them denoted lightness level 0, lightness level 1, lightness level 2, ..., lightness level 255) these Histograms measure the number of pixels in an image having the corresponding lightness level. Take a look at the Histogram of the Okinowa image again.

Histogram of Okinowa Image

Along the horizontal axis, if you count the number of intervals that are formed by any two of the larger tick marks you'll see that there are 25 and a half of these intervals. This means that each interval contains 10 of the lightness levels (25.5 times 10 equals 255 then add the starting point, lightness level 0, and you get 256). The height at any point along one of the histogram graphs corresponds to the number of pixels in the image with the lightness level on the horizontal axis directly below the point you're looking at. In the graph below there are 5807 pixels at around lightness level 225 in the red component of the photo it represents (see next two paragraphs below).

lightness level example

Starting from the far left on the horizontal axis the lightness levels are dark and become progressively lighter as we move to the right. Here are the actual lightness levels in a palette.

lightness palette

Since any color can be thought of as composed of red, green, or blue (at varying intensities), with a certain amount of gray thrown in (our lightness levels) the Histogram measures the lightness level in each of the color component parts of the image--the red graph, the blue graph, the green graph, and finally the luminance graph which is a weighted average of the lightness from the blue, red, and green components. Remember we see green more easily than the other two colors so the green lightness levels should count more in a measurement of overall lightness which we call luminance. These graphs of the lightness levels can help us determine problems with a photo.

Below we have a few examples of Histograms which might lead us to perform some sort of brightness and/or contrast correction. The height width and location of the "humps" of the histogram on the left tells us that the majority of the pixels in the image have a great deal of gray in them. That is to say, the Histogram on the left displays information about an image that is too dark. (This is the Histogram of a dark photo located here).

The Histogram on the right displays information about an image that doesn't have enough contrast and is a bit dark. The rain has literally washed out the contrast in colors. This characteristic is reflected by the histogram graphs in that they do not spread across the full lightness axis. (This is the Histogram of a washed out photo located here).

   


By now you may be saying to yourself, "Wait one minute here! I could tell all that by looking at the image. And even if the Histogram said the image was too dark or too light, I could disagree. I WAS the one taking the picture, after all!" Granted, if we look at an image, more than likely we're going to know whether the image is too dark, too light or just perfect and perhaps whether the image has enough contrast (the image will look washed out). The perceived brightness of an image after all is mostly a matter of taste. (You can perform a brightness and contrast enhancement on the image at the top of the page. I call this work on the image enhancement since the Histogram says that the photographer did an okay job. Take a peek.) Now let's consider the histogram of the image below. The large photo is located here:

yellows    reds


The Histogram on the right above displays information about an image that is badly over saturated in the Blue color channel (Blue hits the floor long before green or red) and is too dark. A tutorial covering techniques for correcting this photo is forthcoming, but let's analyze the Histogram window. Uncheck red, green, and blue. Check luminance if it isn't already. Now uncheck luminance, and check red. Do the same for green and blue.

luminosity histogram red histogram
green histogram blue histogram


Clearly, there's something of interest with blue. To see how badly damaged the blue in the photo is select Colors-Channel Splitting-Split to RGB. We get three grayscale images, the red image, the green image, and the blue image. Substitute the word channel for image and we have the red, green, and blue channels.

original red channel
green channel blue channel


As you can see, blue is severely damaged so any correction or enhancement of this image must primarily focus on fixing the blue channel. Moreover, if you look at the Histogram graph of each of these three images you will see that they are identical to the corresponding Histogram graphs obtained from the one color image.

One note of caution. You should always look at each of the Histogram graphs of each color channel individually as well as together. When they are placed on the same graph a re-scaling occurs so you can see the relative differences. When they are viewed separately, you get a better picture of the shape of the color channel's graph. We can see another example of the Histogram's use by continuing on with the tutorial.
prev
next