Showing posts with label histogram. Show all posts
Showing posts with label histogram. Show all posts

Wednesday, April 4, 2012

How do I interpret individual colors on RGB histogram?

Question

I know how to read the Luminosity histogram and I thought that I knew how to read RGB histogram as well, until I saw the following example:

enter image description here

The RGB histogram shows exactly the same 3 'spikes'. What are these? I can tell that they all come from the same 'sky' source, but why aren't they on the same horizonstal place?

Asked by ClarityForce

Answer

Simple: the color of the sky is comprised of the mix of all three channels. If it were gray, there would be equal amounts of red, green, and blue. It's not, though — there's a lot more blue, a little less green, and very little red. Pretty much like this:

rgb

Check out how the arrows on the slider are pretty much exactly at the same percentages as the spikes in your histogram.

If you put the sliders all in the same place...

gray

...the histogram lines would coincide, but your color would change...

compare

...to dark gray instead of the kind of teal it was in your sample image.


Here's a representation of the digital form of this file. Each pixel is a triad of (red,green,blue), so a teal pixel is represented as( 28,123,142). Because there's only so much room to type, I'm making this very low resolution but you should get the idea. Here, the values go from 0 to 255.

( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)
( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)
( 28,123,142)  ( 28,123,142)  (201,201,201)  ( 28,123,142)  ( 28,123,142)
( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)
( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)  ( 28,123,142)

This ends up looking like this tiny little thing: sample

I don't have the same software you do, but load it in to your program and look at the histogram. The histogram just shows a graphical representation of the counts of each channel at each level. You should see a little bump over to the middle right representing the gray dot, and then spikes at 28 for red, 123 for green, and 142 for blue. Here's what it looks like in the software I have:

histogram of sample

The image doesn't look very red, and it's not. But what red there is is clustered all in that one color, and that's a huge percentage of the image, so you get a spike.

This is a rather technical tool, and while it can be very useful, it doesn't show a nice perceptual map of the colors in the image. That would be a different visualization.

Something that might be more like what you want is called a "3D Color Histogram". The Color Inspector Plugin for ImageJ does this, or you can use this web site: http://3dhistogram.com — which I just discovered and which looks pretty nifty (and no-hassle) but is maybe more cool than useful.

Answered by mattdm

Tuesday, February 21, 2012

How and why do you use an image histogram?

Question

I realize that an image histogram is a graphical display of an images tonal distribution (i.e. horizontal darks to lights, vertical pixel distribution), but how do YOU really use it and why? I mean, can't you determine everything you need just by looking at the image? I imagine there is no right answer, but I'm interested to hear how others use it (or don't) and why...

Answer

While there may not be a "right" answer to this question, there are "correct" answers. A histogram is a powerful tool, and when you understand how to use it effectively, it can greatly help your photography.

As you mentioned, a histogram is a representation of tonal range and distribution in a photo. The basic mechanics are as such:

  1. A histogram represents tonal range from left to right, with blacks and shades to the left, progressing through midtones in the middle, to highlights on the right.
  2. The "volume" of any given tone is represented by the height of the vertical line that represents that tone.
    • A vertical line at the very left end is indicative of the volume of total black tones
    • A vertical line at the very right end is indicative of the volume of total highlight tones
    • A vertical line in the very center is indicative of the volume of 18% gray tones
  3. The tones for an image are taken from the intensity of each pixel (chroma, or hue, is ignored, and only brightness/lightness/luminosity is measured)
    • The total number of tones in an image is dependent upon the bit depth of the image
    • An 8-bpp (24-bit) image has a total of 256 distinct tones
    • A 12-bpp (36-bit) RAW image has a total of 4,096 distinct tones
    • A 14-bpp (42-bit) RAW image has a total of 16,384 distinct tones
    • A 16-bpp (48-bit) RAW image has a total of 65,536 distinct tones
    • A 32-bpp (96-bit) HDR image is effectively able to represent infinite tonal range
      • As a real (float) number, its values range from 1.0 x 10^-37 through 1.0 x 10^38
      • In more real-world numbers, tonal range from black, through very dim starlight (0.00001), through indoor lighting (1-10), through the sunlit outdoors (1,000,000), to the brightness of the sun itself (100,000,000) and well beyond can be represented in a single HDR image
  4. There is no technical limit to the height of a histogram.
  5. Unless you have a very low-bit image, a single histogram is generally incapable of representing every single individual tone in an image, so each vertical line tends to represent a small range of similar tones.
  6. A color histogram can represent a much greater range of information than a pure tonal histogram in the same space.

Given these facts about a histogram, there is a wide variety of information you can gleen from one:

  • Contrast
    • Contrast is the measure of difference between the brightest tones and the darkest tones.
    • The more range a histogram covers between its left and right edges, the greater the contrast of an image.
  • Key
    • Key is the rough measure of brightness in an image, with high-key being brighter, and low-key being darker
    • If the histogram is bunched up in the highlights, you have a high-key image
    • If the histogram is bunched up in the shades and shadows, you have a low-key image
  • White Balance
    • When using a colored histogram, the convergence of red, green, and blue peaks is an indication of white balance
    • In particular, the offset of major blue peaks can be a strong indicator of the warmth or coolness of a photo
  • Tonal Range
    • The balance and height of peaks in a histogram is an indication of tonal range and tonal balance
    • Parts of the histogram that are very low (valleys) indicate very low volume for those tones
    • Parts of the histogram that are very high (peaks) indicate very high volume for those tones
  • Color Volume
    • A basic colored histogram will often show gray, red, blue, and green
    • A more advanced colored histogram may also show yellow, magenta, cyan
    • Colored peaks are an indication of the volume of those given primary colors
    • The horizontal position of a colored peak is an indication of the tone of colors of that particular primary or primaries
      • Gray indicates a balance of primary colors at those tones
      • Off-primary color peaks (or partial height lines), such as yellow, magenta, and cyan, indicate a blend of two primary colors at those tones

EDIT:

As mentioned by Jordan H., there is a trick called "expose to the right" (or ETTR) that can be useful to get you the optimal RAW data. When shooting a scene, particularly those that have a broad range of contrast that may be on the border of, or possibly slightly beyond, the 5-6 stop dynamic range of a digital camera, capturing enough tonal range in the shadows can be difficult. This is due to the the limitations of most current digital sensors, and how they are more sensitive to highlights than shadows. "Exposing to the Right", which is a technique where you slightly overexpose your shots by 1/3 to 1/2 of a stop (which, in turn, shifts your histogram to the right...toward highlights), can help mitigate these limitations. Exposing to the right can also help alleviate noise problems in the shadier parts of your images. It should be noted that exposing to the right requires that you use RAW format, as only with raw are you saving enough information to correct your overexposure during post-processing to bring your image back into normal range. The benefit of this technique is that it allows you to capture detail that would otherwise be lost, without the need to resort to ND grad filters or other more extreme measures.

This guideline is just that, a guideline. With newer camera sensors, dynamic range is improving, and capturing a greater range of contrast in a scene with a single shot is easier. However, even as digital sensor dynamic range improves, there will always be times when we need to shoot "on the edge" or what is possible, and tricks like shooting to the right will always be useful.

Answered by jrista

Sunday, December 18, 2011

Is it possible to get the Histogram display in Lightroom to only consider the area selected by your cropping?

Question

I've noticed that when I crop a photo, the histogram does not change. If I am then making changes based on the histogram (ie. exposure, fill light, blacks, etc...), it would seem to me that the histogram would be more useful if it was based only the area I had selected in my crop.

For instance, if the histogram indicates that I have blown highlights, or vastly underexposed parts of my photo, but I have cropped to remove those areas, wouldn't the histogram be more useful if it represented that?

Maybe I'm wrong, if so, please let me know why!

Thanks - Sean

Answer

The histogram in Lightroom 3 does change. Here's an example:

Full frame

full frame image

Cropped

cropped image

You'll note that the cropped image has more image information in the top third of the histogram, whereas the uncropped one has more in the lower third. That's what you would expect. So the question is, why aren't you observing this? Are you using Lightroom 3?

Friday, September 2, 2011

What does it mean if the main peak of my Histogram is beyond the top of the chart?

Question

I tried reading this thread about histograms, but couldn't understand it well enough to answer this question.

I took some shots yesterday where the main peak of my Histogram was actually off the chart. The histogram had one large peak and most everything else was very low. What exactly does this mean, and if it's something bad (I expect that it is) how can I avoid this in the future?

Here is the Histogram in question :

and the image can be found here. (Update: I altered the photo, so the link is taking into account Jrista's excellent suggestions. This histogram no longer corresponds to this photo.)

Answer

The height of each individual, vertical line in a histogram indicates how much of that particular tone your image has, or the tones intensity. As tones in a histogram progress from left (black and shades) to right (brights and highlights), where a particular vertical line lies indicates how intense the tones represented by that line are.

If one particular tone is extremely intense, and the rest are very low, then the image is primarily comprised of that (or those) particular tones. Generally, this happens in the highlights when they get blown out. It it happens somewhere else, then the histogram is simply telling you that your image is almost entirely composed of that particular range of tones.

It should be noted that the histogram generally does not show enough vertical lines to represent the entire tonal range of an image. Every individual vertical line in a histogram usually represents a small range of tones.

Wednesday, July 13, 2011

How does histogram shape affect the aesthetics of a picture?

Question

For having more contrast in an image, it's good to have a wide range (i.e. difference between highest and lowest) of light intensities in a picture; and for keeping details, neither highlights nor shadows should be clipped.

But are there any other, more specific, guidelines on how distribution of light levels would affect perception of a photograph? Are some histogram shapes more visually appealing than others? E.g. when setting up lighting, should I strive for a flat histogram, perfectly symmetrical histogram (a normal distribution), or local peaks at both ends?

Answer

In short, there's no useful connection. The histogram shows a certain view of the information in an image, and it's useful for avoiding some specific problems and can be used in image analysis, but without referring to the original image, you can't really tell if a particular histogram shape is good or bad (or even if things which look like they might be problems are actually problems).

The look of the histogram will depend on your desired result, and there are many possible desired results which are perfectly valid. A high-key photograph will be shifted towards the right side of the image, with almost nothing on the left (which represents the shadows). A low-key photograph will be the opposite. As that link goes into excruciating detail over, this is not to be confused with high-key lighting, which will generally produce a quite even histogram; or with low-key lighting, which will produce a largely left-side histogram with some spikes on the right. As you can easily imagine, all of these might produce aesthetically-appealing results, and there's no particular right answer (even for the same subject).

The histogram is a tool for visualizing a the information in an image "sliced" in a certain way — it discards certain information (in this case, spatial/location information) in order to make other information more clear. But that information is actually required for making the kind of aesthetic judgment you're looking for. The histogram shows you the relative amounts of darkness and brightness, but you really need to see where the light falls to decide if an image works or not.

A visualization tool that might be more useful for this sort of thing is a grayscale "pixelated" diagram of the image (simply made by converting to grayscale, scaling down to a tiny number of pixels, and then back up again).

Guen with BalloonGray Pixelated Diagram

It's pretty obvious that there's still no right answer here for one pixel diagram to be better than another, but I think it can be a useful way for thinking about the placement of light in the image. The example I chose is one where the histogram looks basically fine, but the resulting image doesn't quite live up to what I was aiming for. The grid visualization is another way of thinking about the overall lighting that I do find helpful. (Do I really want that splotch of brightness in the bottom right?) It's not perfect, of course — while the dark bar in the right-middle might draw me to look at whether that shadow is problematic (and I think it is), it glosses over other also-important lighting details, like the shadow of my daughter's legs on the log, for example.

Tracing the image (either programatically or by hand) to produce a block diagram with actual shapes of bright areas and shadows might be even better. One particular problem I notice here is that the subject's face is split between "pixels", making that bright spot less apparent. If I did the diagram by hand, that'd a clear shape. Of course, that's a lot more work!

Here's the histogram for the same image:

Balloon image histogram

This shows that the overall exposure is pretty good, with detail retained in the shadows — some blown-out highlights, but not many. That happens to be the specular reflections of the lights on the balloons — but there's no way of telling that from the histogram. And there's another weird bright spike, which turns out to be where the red and green channels are blown out in the yellow flames. Also, you can see that there's some other bumps — the one towards the right turns out to be mostly the result of the large blue balloon. If the balloon were a different shade, that "hill" in the histogram would be located elsewhere, making the shape of the overall histogram different — but the overall image would not be very different at all.

To me, the difference between the kind of analysis you can do with the histogram and the analysis you can do in looking at the lighting and composition using a spacial representation of some sort show the answer to your question. The histogram is interesting and useful, but the view it gives isn't such that you can make decisions about the perception of the image as a whole from it alone. You can see if there are certain problems, and you can see if the image as a whole is high-key or low-key, but beyond that there's just not the right data to tell if a certain histogram distribution corresponds to a a lighting situation that works or to one that doesn't.

On the histogram, as you say, keeping the edges from clipping is important, because you can't do anything with values that aren't there. And having an even histogram to start gives you more data to work with. In addition to those things, expose-to-the-right advocates point out that the linear nature of digital sensors means you'll get more room to work if you weight your histogram more to the right side (still without clipping). (But that's advice for working with images intended to be processed into images with "normal" histograms as output, so I don't think it really applies to what you're asking.)