# Do histogram spikes mean anything in midrange?



## vigilante (Dec 10, 2015)

I have a pretty good grasp of the histrogram in my cameras. I know if that any pixels found at the far left are a value of 0 and lost shadow detail. Pixels on the far right are 255 pure white and are basically blown out highlights.

What I don't understand is whether it means anything to have "spikes" in any other range between left and right.

For example, I've read that in terms of vertical space on the histogram, it just means "how many" pixels are in that tone. But what does that mean? How many pixels are there from top to bottom? I don't get that. Is it matched to the resolution of the shot?
If my shot is 4000 pixels tall (24mp) does that mean there are 4000 points from the top of the histogram to the bottom?

I guess the question is, what does it mean if you see spikes in the midrange of the histogram, that is to say, the graph smashes against the ceiling. Is this a bad thing that needs compensation or is it meaningless? What is the real differences between a spike that goes half way up and one that hits the top?

Here is just a random image of a histogram as an example: http://cdn-7.nikon-cdn.com/Images/L...s/2009/Histogram/Media/histogram-main-001.jpg
Notice the spike smashing against the ceiling. What does this mean, if anything?

Thanks


----------



## goooner (Dec 10, 2015)

The way I understand it is that like you say 0 is black and 255 is white on an 8 bit image. In the sample you showed, there are allot of pixels with the same grey value (eg. >200). If you look at the picture you  will see that more than 90% (just a guess) of the picture has the same grey value (the white of the flower).


----------



## Designer (Dec 10, 2015)

vigilante said:


> For example, I've read that in terms of vertical space on the histogram, it just means "how many" pixels are in that tone. But what does that mean? How many pixels are there from top to bottom?


----------



## Ysarex (Dec 10, 2015)

It's not graphing the number of pixels in an absolute sense, it's graphing a ratio. So you're going to see a tall spike if there's a dominant tone and less of the other tones. It doesn't have to indicate a problem but it does throw up a flag.  Point your camera at a flat painted wall and you'll get that middle spike -- all one tone. If you create a new document in PS and fill it with a sold color the histogram is a single vertical line. The flag thrown is that we typically take photos of scenes that contain a full range of tones and so the tendency of the histogram to exhibit a bell curve shape. That's our average world -- some shadows, a lot of mid tones and some highlights. If a scene doesn't have shadows they won't figure in the ratio so the other tones climb higher in the graph. If the scene doesn't have highlights then they won't figure in the ratio and so the other tones climb higher still = middle spike. Scenes without shadows and highlights -- hmmm, might be flat and boring.

You posted a camera histogram example. It's a single histogram; is it an RGB composite histogram or a luminosity histogram?

Joe


----------



## vigilante (Dec 10, 2015)

Ysarex said:


> You posted a camera histogram example. It's a single histogram; is it an RGB composite histogram or a luminosity histogram?



I'm assuming it's a composite RGB.

I've seen histograms where there is decent representation from left to right, but still contains a spike smashed to the ceiling. I just can't figure out what it really means when it reaches the top. Is there loss of detail or something? Does it mean the actual camera settings should change? Maybe it means nothing at all, but would still like to know how it calculates how "high" in the graph to go.


----------



## KmH (Dec 10, 2015)

*Tones & Contrast*

Understanding Histograms, Part 1: Tones & Contrast
Understanding Histograms, Part 2: Luminosity & Color


----------



## Ysarex (Dec 10, 2015)

vigilante said:


> Ysarex said:
> 
> 
> > You posted a camera histogram example. It's a single histogram; is it an RGB composite histogram or a luminosity histogram?
> ...



You should find out. If you're going to actually refer to it and use it then it matters if it's one or the other. They tell you different things.



vigilante said:


> I've seen histograms where there is decent representation from left to right, but still contains a spike smashed to the ceiling. I just can't figure out what it really means when it reaches the top.



It just means it's off the graph.



vigilante said:


> Is there loss of detail or something?



No.



vigilante said:


> Does it mean the actual camera settings should change?



No.



vigilante said:


> Maybe it means nothing at all, but would still like to know how it calculates how "high" in the graph to go.



As a percentage of the total tonal data graphed. If it's off the graph on the left it means the photo has lost data into pure (0) black. If it's off the graph on the right it means the photo has lost data into pure (255) white. If it's off the graph on the top then it means there's more of that tone as a percentage of the full tonal data than will fit on the graph, but no data loss is indicated.

Maybe this helps. I took a photo that has a lot of white and spikes off the graph in Photoshop (histogram inset).  There so much white it's off the graph. I started to add a bar of pure green and it shows on the histogram -- it's a thin line because it's a single solid color (histogram inset). In the third photo I increased the green to just below hitting the top of the graph. If I increase the height of the green bar to cover the rest of the angled doorway window the thin line is off the top of the graph.




 

Joe


----------



## dennybeall (Dec 10, 2015)

Great example with the green box


----------



## WayneF (Dec 10, 2015)

vigilante said:


> I have a pretty good grasp of the histrogram in my cameras. I know if that any pixels found at the far left are a value of 0 and lost shadow detail. Pixels on the far right are 255 pure white and are basically blown out highlights.
> 
> What I don't understand is whether it means anything to have "spikes" in any other range between left and right.
> 
> ...



The height in the histogram is 1) relative, and 2) meaningless.  The data will ALWAYS reach the top.   All real data *histograms are intentionally scaled so that the maximum height does reach the top* (or very very close).   The purpose is to make the data taller and easier to see low values, to be able to see WHERE it is  horizontally, tonally.  The height is just the count of the pixels, and we could not care less if the peak means 10000 pixels or 90000 pixels.  Don't know, don't care, unconcerned with the count, but a peak is a large area (many pixels) of that one color.  The height is NOT related to the pixel height size of the image.  The relative height shows the COUNT of the pixels with that tonal value (scaled so the peak reaches the top).

A peak in the middle somewhere means nothing, other than this scene had a large area of pixels of the same mid-tone color.  That's just what this scene is,  and it's hard to change the scene.    (OK, lighting could change it).  If you don't like that middle peak, go find some other scene... this scene has it.

If you edit an image tonally, like the Levels white point, etc, as you move it and change tones,  you will see the heights change drastically, jumping all around.  It is just recomputing the new tonal values, and rescaling so that the new peaks reach the top. Tones you may not have even adjusted are jumping around that way.  Height is relative, and means nothing in any absolute sense.  The tallest peak will reach the top. Meaning, if there are no noticeable peaks, the entire data curve will be high, approaching the top.   And relatively, a peak just means a large image area (lots of pixels) all of the same brightness represented horizontally there.

All that is really of much concern in a histogram is the possible clipping at the bright end, denoted by a peak right at 255, which is clipping, and means overexposure. We should back off on exposure so we don't have clipping, otherwise it is not recoverable.   OK, it's generally good if the "average" data does approach the right end (generally and vaguely implying full and proper exposure of many "average" scenes), but NOT piling up there (and there are dark image exceptions that don't reach the right end).  So actually,  even approaching depends on the colors in the scene... but most average images are suitable for approaching... white clouds, bright skies, white shirt, white house or car, whites of eyes in portraits, etc.  It is not just white, many colors can be bright, yellow, green, red, etc.  Red flowers in sunlight (like roses) are real bad about clipping in the red channel.

But if that tall peak was at the right end at 255, now THAT would be a very serious major issue.    But the picture of the proverbial black cat in a coal mine surely should not reach near the right end (because it should be black).  But lots of average scenes have some white or bright that reasonably should approach the right end.  But should not actually get all the way there. This checking for clipping is really the only major practical importance of the histogram, and it is important, why we have histograms.

Contrast is another factor. High contrast means blacker blacks and whiter whites, more data range, data extending full range.  So we do want to fill most of the full range (generally, but again, it depends).   The black end normally has data in digital cameras, but it can be a problem in scanners, requiring correction at the black end.

Clipping needs more comments.  There are two types of histograms, the set of three histograms with individual channels for red, green and blue.  Also there is the single gray histogram intended for grayscale. Nikon cameras show both, probably most others do too.  But the single gray histogram is is a math manipulation that does NOT show real RGB data values (called luminance, representing brightness as seen on a B&W screen).   It shows different modified data that does not exist in our image file.  Not showing real data, not showing true position, so it is WORSE THAN EXTREMELY POOR about showing clipping,  it's a good bet that heavy clipping might not show at all as clipping.

Photo editors are different, they typically show one histogram, and Photoshop Levels is even gray (not luminance, but it does not differentiate to show color).  But these are more sophisticated, and they do show the three RGB channels overlapped, real true data, in true position.  No problem there, but do seriously avoid  using the cameras single gray histogram.  And the photo editor is too late to solve clipping. that's what the camera histogram is for.

See There are Two Different types of Histograms  for more explanation.  But in the camera, always use the three RGB histograms.  Otherwise you are fooling yourself, big time.  Why the camera shows the mono histogram is a mystery to me.


----------



## vigilante (Dec 11, 2015)

TMI

Thanks nerds.

I wasn't aware of the problems with the single black&white histogram. I'm now using the RGB version instead.


----------



## Ysarex (Dec 11, 2015)

vigilante said:


> TMI
> 
> Thanks nerds.
> 
> I wasn't aware of the problems with the single black&white histogram. I'm now using the RGB version instead.



Do you save and process raw files or just camera JPEGs? If you shoot and process raw files would you like to hear about accuracy issues using the camera histograms with raw files?

Joe Nerd


----------



## WayneF (Dec 11, 2015)

I tried to cover the raw histogram issue at There are Two Different types of Histograms

Extremes of settings like white balance, contrast, saturation, etc, shift tones and can cause clipping.  High WB temp in the red channel, low WB temp in the blue channel.  Of course this happens to JPG too, but we can see the histogram for JPG, and correct it.

Raw data does not have a histogram, but it does embed a large JPG image (into raw file), which is the histogram and image preview we see in the camera.  If there is an approximately correct WB (the camera settings for JPG), it does not affect the raw data, but it affects the histogram we see, probably in a similar way as our probable raw WB result later, and that works out pretty well.  Of course, the main issue is still that we shoot raw so we can correct the wrong stuff the camera settings would do, so an exact match really is not going to happen. But raw still offers much opportunity.

I distrust Auto WB, it varies from a little off to a lot off, but at least it does try a little, and we never know the proper precise WB to set anyway, so I use Auto WB for shooting raw. Not because it can affect the raw data, raw is raw, but just to be able to see the histogram it hopefully produces with approximate expected settings.


----------

