- Histogram equalization
- Steps Involved
- CLAHE (Contrast Limited Adaptive Histogram Equalization)
Contributed by: Sreekanth
Introduction to Histogram Equalization
Image pre-processing is the term for operations on the images at the lowest level of abstraction. These operations do not increase image information content, but they decrease it if entropy is an information measure. The aim of pre-processing is an improvement of the image data that suppresses undesired distortions or enhances some image features relevant for further processing and analysis tasks.
There are four different types of Image Pre-Processing techniques, and they are listed below.
- Pixel brightness transformations/ Brightness corrections
- Geometric Transformations
- Image Filtering and Segmentation
- Fourier transform and Image restoration
Histogram equalization is one of the Pixel brightness transformations techniques. It is a well-known contrast enhancement technique due to its performance on almost all types of image.
A histogram is a representation of frequency distribution. It is the basis for numerous spatial domain processing techniques. Histogram manipulation can be used for image enhancement.
Contrast is defined as the difference in intensity between two objects in an image. If the contrast is too low, it is impossible to distinguish between two objects, and they are seen as a single object.
Histogram equalization is a widely used contrast-enhancement technique in image processing because of its high eﬃciency and simplicity. It is one of the sophisticated methods for modifying the dynamic range and contrast of an image by altering that image such that its intensity histogram has the desired shape. It can be classified into two branches as per the transformation function is used.
- Global histogram equalization (GHE)
GHE is very simple and fast, but its contrast enhancement power is low. Here the histogram of the whole input image is used to compute the histogram transformation function. As a result, the dynamic range of the image histogram is ﬂattened and stretched. The overall contrast is improved.
- Local histogram equalization (LHE)
LHE can enhance the overall contrast more effectively.
One of the drawbacks of histogram equalization is that it can change the mean brightness of an image significantly as a consequence of histogram flattening and sometimes this is not a desirable property when preserving the original mean brightness of a given image is necessary. Bi-Histogram Equalization was proposed to overcome this problem.
- Get the input image
- Generate the histogram for the image
- Find the local minima of the image
- Divide the histogram based on the local minima
- Have the specific gray levels for each partition of the histogram
- Apply the histogram equalization on each partition
- Compute the histogram of pixel values of the input image. The histogram places the value of each pixel 𝑓[𝑥,𝑦] into one of L uniformly-spaced buckets ℎ[𝑖]
Where 𝐿=2^8 and the image dimension is 𝑀×𝑁
- Calculate the cumulative distribution function
- Scale the input image using the cumulative distribution function to produce the output image.
Where CDFmin is the smallest non-zero value of the cumulative distribution function
The below example shows how Histogram equalization modifies the contrast of the Image.
The histogram and cdf were generated for the above image.
Scaled the input image using the cumulative distribution function to produce the output image.
Histogram of Scaled Image
CLAHE (Contrast Limited Adaptive Histogram Equalization)
The above histogram equalization considers the global contrast of the image, and in many cases, it is not a good idea. The human pic in the original diagram is not shown correctly in the histogram equalization output. Even though the contrast of the image had been improved, we lost some of the information due to over brightness. The reason is that the histogram is not confined to the local region.
Adaptive Histogram Equalization helps to solve this issue. In this method, the image is divided into small blocks, and each of these blocks is histogram equalized.
The same image has been converted, and below is the output of Adaptive Histogram Equalization.
The histogram for the above output image is below.
This brings us to the end of the blog about Histogram Equalization. We hope you found this helpful. If you wish to learn more about such concepts, head over to Great Learning Academy and join our free online courses today.1