Calculating an image histogram
We are one step closer to understanding the image content, and one of the fundamental image analysis techniques is calculating the image histogram.
What are histograms?
Histograms are plots used to give you an overall idea about the distribution of the intensity values of a given image. In the x axis, the plot will have values ranging from 0
to 255
depending on the image depth as explained earlier and the y axis will represent the number of occurrences of the corresponding intensity value.
Once you calculate and display the histogram of an image, you can easily gain some insights about the image contrast, intensity distribution, and so on. Actually, if you normalize the histogram, making it sum to one, you can treat the histogram as a probability density function and answer questions such as what is the probability of a given intensity value to occur on an image and the answer is simply the y axis reading at that intensity value. In the following figure, you...