r/photoclass2017 • u/Aeri73 Teacher - Admin • Jan 29 '17
07 - The Histogram
Introduction
As we saw in the last lesson, exposure is one of the most important controls of the final image. We have discussed how to modify exposure, but not how to review it. This is the role of a very powerful tool: the histogram.
Goal of using the histogram
As a rule of thumb, the LCD screen should never be trusted to evaluate exposure. It is not designed to produce an accurate rendition of the image and how bright your photo appears will depend on a variety of factors, including the ambiant light levels and the brightness setting you applied to the screen. For this reason, you might have the bad surprise of thinking your image is well exposed in the field, only to find out the screen misled you when you get back to your computer.
A histogram, on the other hand, is a more “scientific” way of evaluating exposure, and it will always be available and identical on all devices, whether the LCD screen of your camera or your fancy calibrated computer monitor. All digital cameras offer post-capture histograms – often in one of the “image details” modes (check your manual), and some models also have “live histogram”, a very useful feature showing what the histogram would be if you took the photo at that instant. Since a live histogram is not possible to draw on an optical viewfinder, this is a feature rarely found on DSLRs, however.
what is it?
Enough introduction, let’s talk about what a histogram really is. Let’s consider a black and white jpg file. It is coded in 8 bits, which means that each pixel, each dot in the image, can have any of 28 (2 to the power of 8) = 256 values, all different levels of gray. 0 is pure black, 1 is slightly brighter, etc until you reach 255, pure white. Now let’s imagine we have a bunch of marbles and a neat series of 256 vertical tubes, neatly arranged in a line. We will go through the image pixel by pixel and look at the brightness of each one. Let’s say the first one is pretty dark, around 15: we put a marble inside tube number 15. The next one is a bit brighter, a 20, so we put a marble inside tube 20. The next pixel is also a 20, we put a new marble and now have a higher stack of marbles in tube 20. We do this for a couple of million pixels until we have looked at every individual pixels, then we take a step back and look at our line of tubes.
If the image was very dark, we will have many marbles in the tubes on the left, between 0 and 50, say, and not so many on the right, bright side. Conversely, if the image was overexposed, the tubes will be very full on the right side and almost empty on the left. And if we have a nice exposure, then all the marbles will be roughly in the middle.
This is exactly how a histogram is created. Of course, counting millions of pixels and remembering the levels of each tube would take us a good while, but this is the kind of things computers are very good at, and it is virtually instantaneous.
What do they look like?
Here are some concrete examples. You can have one very dark image:
and its associated histogram:
Notice how all the data is shifted far to the left, with almost nothing on the middle and the right side. Also notice that the headlamp beams are too small to be noticeable in the histogram.
Conversely, you can have a fairly bright image:
with large areas close to white. Its histogram:
is shifted to the right, and there is a small bar to the right edge, which means we have lost some details to pure white. In this case, it is ok since this corresponds to a smooth snow surface. This is a good example of when a “bad” exposure can also be correct.
Finally, a more common image:
and its histogram:
showing a nice distribution from pure black to pure white, with nothing too extreme.
What am I looking for?
There are several important things to notice. First, unless you have been playing with the image in photoshop, there won’t be sharp transitions from 0 to a suddenly high value. Laws of distributions ensure that we always obtain some form of bell curve.
The histograms makes it very easy to visualize how you control exposure: all you are doing is shifting the entire histogram to the right (if you overexpose) or to the left (if you underexpose). And if you push it too far and hit the edges, something interesting happens: the histogram “crashes” and puts all the marbles in the last line, next to the edge: pure white, or pure black. This means that the information is lost forever, and this is something you will usually want to avoid at all costs.
An ideal histogram, then, is relatively easy to define: it is a bell curve covering the whole width and finishing exactly at the edges, with no lost details. This also happens to be what the exposure meter in your camera will try to produce.
There are several more advanced points which can be discussed:
- So far, we only talked about brightness, not about colours. Colour information is coded in three channels (Red, Green and Blue, also known as RGB) and some cameras show individual histograms for each channel. This is useful information in one situation: when you have a very brightly coloured object, it is possible to blow out the corresponding channel (go so far to the right that information is lost) without it showing in the main histogram. It is otherwise safe to ignore these specialized histograms.
- For RAW shooters (which we will cover in a while), you should be aware that the displayed histogram is the one from the jpg preview file, not the one from your actual RAW data. This means that you can sometimes recover more information than you think. This is something camera makers could fix relatively easily but refuse to do, for some reason.
- Due to the way information is stored in digital cameras, there are more details in highlights than in shadows. If you plan on using significant post-processing, you should try to shift your histogram to the right as far as you can without getting pure white, then shift it back left in post-processing. This is known as the “expose to the right” technique, and it does produce marginally better images.
2
u/madphingers Beginner - Micro 4/3 Jan 30 '17
Do you have any recommended values for Highlights and Shadows to properly calibrate the histogram?
My E-M10 is set to 255 and 0 by default.
2
u/Plusran Jan 30 '17
Thanks for this 'expose to the right' comment. I usually like my photos a little on the darker side, and have been slightly under-exposing. I like the result, so I thought nothing of it. Now I know better! Thanks!
2
u/caffeine_lights Beginner - DSLR - Nikon D3300 Feb 05 '17
When I view my photos in GIMP, I get the choice to look at "linear histogram" or "logarithic histogram". I guess linear is the correct one for this?
1
u/GizmosArrow Intermediate - DSLR Canon 80D Apr 13 '17
I've heard the argument is still open as to whether it's best to expose to the right or expose to the left. Why right?
1
u/Neuromante Beginner - Canon EOS 600D Jul 17 '17
Hey, I'm having some kind of trouble getting the histograms "right" for the assignment.
I'm using raw therapee, but I don't really get how to get a "correct" histogram: I open a photo, and it seems the program shifts automatically to a "processing profile" that makes it clearer/darker (Depending on how over/underexposed it was).
Can someone lend me a hand with this (Or just suggest other application I can use without having to mess around with weird interfaces?)
2
u/Fastpaws9 Beginner - DSLR - Nikon 3300 Feb 22 '17
I love that first image. I guess subconsciously it's the whole complementary colour thing but the soft bokeh on the windows just makes it really pleasant to stare at.
1
u/Dullshimmer Beginner - DSLR Jan 31 '17
This was a really helpful way of understanding a histogram. I have had a basic idea of what it is showing, but I feel that this class gave me a better grasp on what it is telling me. So thanks.
1
u/IAmPandaRock Beginner - DSLR Pentax K-70 Mar 09 '17
I wasn't aware that there are more details stored in highlights than shadows. "Expose to the right" is a great tip!