It is currently Sun Jan 21, 2018 9:25 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Tutorial - The Histogram
PostPosted: Thu Nov 04, 2010 5:03 pm 
Offline
Site Admin
User avatar

Joined: Thu Mar 04, 2010 5:50 pm
Posts: 500
Location: Bradford, England.
This tutorial is aimed to hopefully help you understand one of the most under-used yet most valuable tools in digital photography - the histogram. It's a wonderful tool and it was an absolute revelation for me when I learned how to use it several years ago. Digital photography is actually quite a limiting and unforgiving medium; you can't push it like you can film and still get pleasing results, and so to get the best out of digital as a format you really need to understand a bit about how it works, and a little technical background knowledge on how digital cameras produce an image can really help in getting the most out of it. The histogram is a key part of that understanding, so I've written this little tutorial in the hope it may help avoid over (and under) exposure when shooting and editing.


The images you upload to photography sites on the internet are known as 8 bit JPEG images. 8 bit refers to the number of levels the different brightness values in the image are split into. The more bits you have, the more levels of brightness are available. In 8 bit the brightness values range from 0 to 255, so the tonal range is split into 256 levels. For the sake of ease we'll first look at an 8 bit grey scale image which has a single channel of information that can display 256 levels of brightness per pixel, with 0 being off (or pure black) to 255 (or pure white).

So let's take a quick look at the histogram. This is the luminosity histogram for a grey scale image we'll look at in a second, but here you can see the X-axis shows brightness and the Y-axis shows the number of pixels that are outputting a given brightness value.


Image


Knowing what information the histogram is showing us means we can take a rough guess as to how the image looks in terms of brightness even without seeing it. We can see a large peak to the right, meaning the image contains a lot of light grey tones and the peak to the left indicates a reasonable sized dark area.

Here's the image with the same histogram overlaid, and arrows linking areas in the histogram to their respective parts of the image.


Image


The above image is quite well exposed and isn't showing any signs of over or under-exposure. As mentioned, the range of tones available for this image is 0 to 255. When we try push the exposure to beyond 255 we're no longer able to see any more detail because the overexposed pixels are already outputting their full value (pure white), so the more we push things the more detail we lose. If we overexpose the same 777 image the histogram starts to do interesting things. This is the same image but pushed a stop in brightness. Notice the graph now has a peak running up the right side and a massive amount of detail is missing. The white fuselage and large areas of the sky now appear as bland and uniform areas of white with no tonal variation, leading to a fairly ugly image. This is quite drastic overexposure but it illustrates the effect it has.


Image


If we now darken the image by a stop, we'll see the reverse happen. In this underexposed image we now see a general lack of brightness, and the histogram confirms this by showing no information to the right of the graph.


Image


In the correctly exposed image we can see the information just touching both sides of the histogram. This is ideal as it shows you're making the most of the dynamic range available to you and all tones from the darkest to the lightest are present.

Now we know what under and overexposure look like on a grey scale image with a single channel of information we can now look at the same image in colour.


Image


This is an 8 bit RGB (colour) image, and instead of having a single channel ranging from 0 to 255 we have three channels (one red, one green, one blue) each individually ranging from 0 to 255. This is why an 8 bit RGB image (or 8 bit LCD computer display) is said to have 16.7 million colours:

256 x 256 x 256 = 16,777,216.

The histogram overlaid on this image is showing each of the colour channels individually and also the Luminosity histogram at the top, which is essentially the sum of the three channels. When using the histogram to judge exposure it's important to understand that there are two types of histogram available for colour images, RGB and Luminosity, and to understand the difference it helps to know a little about how a pixel actually works.

There are, in essence, three parts to each pixel on your camera sensor. One red, one blue and one green (most digital camera sensors actually have twice as many green as they do red and blue but we'll ignore that fact for the moment). This is exactly the same as a pixel on your computer screen, which makes how overexposure in a colour image occurs very easy to demonstrate.

This area behind the box is essentially acting like a single giant pixel and is showing us what the Luminosity histogram is reading. Circled in red you can see the three values for the red, green and blue channels, and we can adjust each individually and see the results behind. Here all three are at zero, so as all three are showing no output the result is black.


Image


If the three values are kept the same then the result is varying shades of grey:


Image


If the values are different, we get various colours:


Image


We can push one or even two channels to the max and as long as the third isn't at 255 we won't overexpose:


Image


But if all three are at 255 then we get pure white and overexpose:


Image



This is known as 'clipping' and in essence is exactly what happens when you turn a car stereo or any other audio amplifier up too loud. As you try push the volume beyond the units capabilities you start to hear distortion, and this distortion is caused because you're trying to ask the amplifier to output more power than it's being supplied with. Because the amplifier can't do this it 'clips' the top and bottom of the wave when it hits the limit of its power supply. Once this point is reached it becomes impossible to hear any detail beyond the point the wave is clipped; all that detail is lost and can only be recovered (or heard again) by turning the gain down to a more reasonable level.

We can look at overexposure of a digital image in a similar way. Say for example we're shooting that BA 777 and we overexpose. Once we hit 255 the clipping pixels can't record anything beyond that point. They've lost their ability to record detail and the only way we can get detail back is by 'turning down' the exposure. Shooting RAW with a higher bit depth (and hence more data) can help in recovering lost highlights from overexposure but it's always best to keep an eye on the histogram when you're shooting to avoid the problem in the first place.


Just to quicky show the difference between the RGB and Luminosity histograms, let's now compare them for the BA 777. The first is the Luminosity, and as in the grey scale image it shows good distribution of tones with nothing spilling up the left or right sides.


Image


The RGB histogram is simply the individual red, green and blue histograms laid on top of each other. In the original image the red channel is clipped slightly, which as we've seen from the giant pixel demonstration isn't a problem as both the other channels are fine. The problem with the RGB histogram for this image is it's showing what could be wrongly interpreted as overexposure from the red channel being clipped, so if we use this to judge exposure then we'll over-compensate and end up with an image lacking in contrast.


Image


So we've covered what the histogram is, what information it shows, what under and over-exposure look like and how the conditions for overexposing a colour image arise. We've also gone into the reasons why it's extremely important to only use the Luminosity histogram for judging exposure.

Finally, a quick look at another use for the RGB histogram; to help setting White Balance.

White Balance on digital cameras is the relative levels of the red, green and blue channels with each other in order to render colours accurately. Different types of light (sunlight, cloudy conditions, sodium light, halogen floodlight, etc) all have different colour temperatures and thus all show white differently unless we set the camera to that temperature. Because the RGB histogram shows us that relative balance it can be a great tool in aiding White Balance adjustment.

Again, we'll look at the RGB histogram for the 777 image. Notice the red, green and blue channels are different but the main peak is in roughly the same position to the right in all three. This is showing the three channels are balanced and as such the whites appear reasonably accurate.


Image


This is how the image would look had the white balance been set too cool. The Luminosity histogram is still fine, but blue channel now peaks in front (to the right) of the green with red being behind. We see the effects of this in the image as the whites now have a pronounced blue tint.


Image


And here's the image a bit too warm. The reverse has happened here with the red channel being the furthest to the right. The whites reflect this, now showing a strong red tint.


Image


This gives us a good guide as to when the White Balance is somewhere near right. It doesn't work for all images and certain images (like sunrise/sunsets) will be biased one way so how the image looks should always be the main priority, but this is just another little use the histogram can have.

A quick final few points:

- Always use the Luminosity histogram on your camera as a reference to avoid overexposure when shooting. If you're blowing highlights then dial in some negative exposure compensation, and if the histogram shows the highlights are lacking dial in some positive compensation.

- When editing, be sure to keep a close eye on the histogram. Tools like the Burn tool can help deal with very localised overexposure like landing lights or reflections from the sun, but anything more than a very slight line going up the right side is likely to result in an overexposed rejection.

- Be sure that you use the Luminosity histogram when judging exposure. The histogram shown in Photoshop's Levels tool is an RGB histogram, so if you're making Levels adjustments be sure to use the Luminosity histogram found in Window - Histogram, making sure it's set to Luminosity.

- If you're feeling adventurous or interested in trying a new technique, using the RGB histogram to set White Balance can work very well. Just be sure to still trust your eyes and be aware certain types of image may naturally be biased towards the warm or cool end of the spectrum.


Hopefully this has been of some use. If you have any further questions regarding any part of this tutorial then please ask here, and if there's another area of aviation photography you'd like to see a tutorial written for then feel free to make a suggestion and we'll see what we can do. :)

_________________
FocusOnFlight admin person, database fiddler, screener, photography geek and chief muppet


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group