Ask Your Question
0

how do I interpret histogram output?

asked 2013-02-21 13:20:57 -0600

Hello everybody,

I'm looking at the example of the histogram from http://docs.opencv.org/doc/tutorials/imgproc/histograms/histogram_calculation/histogram_calculation.html

How should I interpret the histogram output vs the colors in the picture? It seems that the picture has mostly green, followed by brown, white, and blue. How does the histogram graph show that? Or is it a different histogram which does not break the image down into R/G/B channels that we need to look at?

edit retag flag offensive close merge delete

Comments

oh, the colors in the 2nd image there are random and don't represent anything related to rgb. it's just for visualization. if you look at the image at the top, they're trying to show it for a 1channel image.

think of a histogram as a barchart with 1 bar for each possible intensity value in the [0 255] range, a simple array.

you walk through all pixels, and when you encounter the value 17, you just do like hist[17] += 1

the last 2 images at the bottom show an rgb image, and the 3 separate histogram curves, 1 for each color channel

berak gravatar imageberak ( 2013-02-21 13:43:02 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2013-02-22 08:28:59 -0600

If you want to see how many pixel are for a specific green value, look in the g_hist mat. For example, Green = 12, look at pixel g_val = g_hist<float>(12);

Take care of one thing: the number of pixels of value p=(12,13,14) is not the sum of b_hist<float>(12) + g_hist<float>(13) + r_hist<float>(14) because histograms are computed from independent values for each color! As example, p1=(12,10,10) is computed in b_hist<float>(12) also.

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-02-21 13:20:57 -0600

Seen: 247 times

Last updated: Feb 22 '13