Increase Contrast with Histogram Equalization

Histogram Equalization of Image in Detail

Md. Zubair
Towards Data Science
Original Image by Dan Fador from Pixabay (Top left image is the main image, and the bottom left image is the grayscale version of the image. The right-side images are the result of Histogram Equalization)


Histogram is the process of visual representation of frequency distribution with a bar plot. In computer vision, an image histogram is the process of representation of the frequency of intensity values with a bar plot. With image histogram equalization, we can easily adjust the distribution of frequency values of the image intensities. Generally, the process helps us to increase the contrast and brightness of an image. The process is simple and easy to implement. This article will discuss the full process of histogram equalization along with coding examples.

Table of Contents

  1. Image Histogram
  2. Full process of histogram equalization
  3. Step-by-step, hands-on implementation

Image Histogram

Image histogram is the representation of the frequency of image intensity values with a bar plot. In Fig -1, I have shown a sample image with its intensity values in a 2D space.

The values range from 0 to 7. Let’s calculate the frequency of the values.

An image histogram is a simple representation of the frequency against the intensity value with a bar plot, as shown in Fig-3.

Fig-3: Histogram of the Image (Image by Author)

Full Process of Histogram Equalization

Histogram equalization is the process of uniformly distributing the frequency of the image intensity values with the help of some functions. Mainly the functions are probability function — PDF (Probability Density Function) and CDF (Cumulative Distribution Function).

  • PDF is calculated with the frequency of an intensity value divided by the total frequency.
  • CDF holds the probability of a probability distribution less than or equal to a particular value. For example, PDF of the intensity value 0 → 0.12, 1 → 0.24, 2 → 0.12, etc. So, CDF for 1 is 0.12+0.24 = 0.36, 2 is 0.36+ 0.12=0.48, and so on. The entire result is…

Source link

This post originally appeared on TechToday.

Leave a Reply

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