Image Histogram

Hello there,
Today I’ll cover a simple subject, image histogram. What is a histogram? Histogram is a graphical representation of a set of data separated in differents classes. It is represented by vertical bars where the base represents the class and the height represents the frequency/quantity of how many times it happened. Yes, it seems to be more complicated when we try to explain something really easy. Look at the figure 1 below

 

hist_example

Figure 1

 

This is an example of histogram where we count the (fictitious) quantity of engineer who are still working in R&D from 25 to 55 years old. We can see that as people are getting older and more experienced, less they work in R&D and maybe more as project manager for example.

Ok, how does it applies do images? That’s simple. We get an gray scaled image and we count how many pixels for each pixel level, from 0 to 255. Below there are 3 examples:

 

histog_normal

Figure 2

 

histog_dark

Figure 3

 

histog_bright

Figure 4

 

In figure 2, we can see that the image has pixels values from about 25 up to 240 and they are evenly distributed. This means that this image isn’t too dark or to bright in general as we can see in the Lena’s photo in the left. But in figure 3, the histogram tell us that we have only pixels values from about 15 up to 90, which are low values of intensity. This means that the image seems to be in general a little dark. In figure 4 the image has pixels almost all values as in figure 2. We have pixels from about 45 to 255, but we can see that most of the pixels, about 35000, has the maximum intensity and then we can conclude that the image should be too bright.

 

As you can see, histograms can tell us a little about an image. It doesn’t give us detailed information about the image, but an overview of how it is, related to its intensity. In the next post, I’ll show you how we can use the informations from histograms to improve image quality with simple techniques.

 

Bye bye

Marcelo Jo

Marcelo Jo is an electronics engineer with 10+ years of experience in embedded system, postgraduate in computer networks and masters student in computer vision at Université Laval in Canada. He shares his knowledge in this blog when he is not enjoying his wonderful family – wife and 3 kids. Live couldn’t be better.

LinkedIn 

Leave a Reply

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.