You are on page 1of 15

HISTOGRAM

EQUALIZATION

PRESENTED BY:

 FAKHR E ALAM (04161913026)

 UNATI (04161913049)
INTRODUCTION
• Histogram equalization is a technique used in
image processing to enhance the contrast of an
image.
• The goal of histogram equalization is to spread
out the intensity values of an image's histogram so
that the entire range of values is utilized, resulting
in a more balanced distribution of pixel
intensities.
• The histogram of an image represents the
frequency distribution of pixel intensities. It plots
the number of pixels at each intensity level,
ranging from 0 to 255 for an 8-bit grayscale
image.
• The histogram can provide information about the
overall brightness and contrast of an image.
PROCESS OF HISTOGRAM:
1. Compute the histogram of the image: The histogram represents the frequency distribution of pixel intensities
in the image. It calculates the number of occurrences of each intensity value in the image.

2. Compute the cumulative distribution function (CDF) of the histogram: The CDF is calculated by summing
up the histogram values. It represents the cumulative probability of each intensity value in the image.

3. Calculate the transformation function using the CDF: The transformation function is derived from the CDF.
It maps the input pixel intensities to their new values. The transformation function ensures that the pixel
intensities are redistributed in a way that the resulting image has a more uniform histogram.

4. Apply the transformation function to map the pixel intensities: Iterate over each pixel in the image and use
the transformation function to map the old intensity to the new intensity.

5. Stretch the histogram if desired by clipping the intensity values: By default, histogram equalization
stretches the entire range of intensity values to cover the full range of the output.
PROCESS OF HISTOGRAM:

Read the image (pixel by pixel) Get image size Get image Histogram

Get Cumulative
Distributive Function
(CDF)

Assign a nearest available brightness Calculate new values by


Show Graphics Result
values to new scale value Histogram
MATLAB IMPLEMENTATION:
image = imread(‘lena.jpg');

grayImage = rgb2gray(image);

histogram = imhist(grayImage);

cdf = cumsum(histogram) / numel(grayImage);

L = 256; % Number of possible intensity levels


newIntensity = round((L - 1) * cdf);

equalizedImage = newIntensity(grayImage + 1);

subplot(1, 2, 1);
imshow(grayImage);
title('Original Image');
subplot(1, 2, 2);
imshow(equalizedImage);
title(‘Histogram Equalized Image');
1) Image Enhancement: Histogram equalization enhances image contrast and
brings out details.

2) Medical Imaging: Histogram equalization improves visibility of structures


in X-ray, MRI, and CT scan images.

3) Object Detection and Recognition: Histogram equalization enhances


APPLICATIONS OF contrast for better object boundary detection.

HISTOGRAM 4) Low-Light Image Enhancement: Histogram equalization enhances


visibility and improves the quality of images captured in low-light
EQUALIZATION conditions.

5) Satellite and Aerial Imagery Analysis: Histogram equalization enhances


contrast in remote sensing data for land cover classification and object
detection.
EXAMPLE:
• Perform histogram equalization of the 5x5 image.

4 4 4 4 4
• Maximum gray value = 5
• No. of possible gray values = 8 that varies from 0 to 7
3 4 5 4 3
F(x,y)= 3 5 5 5 3
Histogram
3 4 5 4 3
16

4 4 4 4 4 14

No. of Pixels
12
10
8
6
4
Gray level 0 1 2 3 4 5 6 7 2
0
No. of Pixel (nk) 0 0 0 6 14 5 0 0 0 1 2 3 4 5 6 7

Gray Level
Gray Level No. of Pixel PDF = nk/N CDF (sk) = Σ PDF Sk * 7 (Gray Round of
= nk Level) Histogram
Equalization
Level
0 0 0/25 = 0 0+0 = 0 7*0 = 0 0
1 0 0/25 = 0 0+0 = 0 7*0 = 0 0
2 0 0/25 = 0 0+0 = 0 7*0 = 0 0
3 6 6/25 = 0.24 0+0.24 = 0.24 7*0.24 = 1.68 2
4 14 14/25 = 0.56 0.24+ 0.56 = 0.8 7*0.8 = 5.6 6
5 5 5/25 = 0.2 0.8+0.2 = 1 7*1= 7 7
6 0 0/25 = 0 1+0 = 1 7*1 = 7 7
7 0 0/25 = 0 1+0 = 1 7*1 = 7 7
Input Image Output Image
4 4 4 4 4 6 6 6 6 6

3 4 5 4 3 2 6 7 6 2
After Equalization
3 5 5 5 3 2 7 7 7 2

3 4 5 4 3 2 6 7 6 2

4 4 4 4 4 6 6 6 6 6

Gray level 0 1 2 3 4 5 6 7 Gray level 0 1 2 3 4 5 6 7


No. of Pixel (nk) 0 0 0 6 14 5 0 0 No. of Pixel (nk) 0 0 6 0 0 0 14 5
Input Image Histogram Output Image Histogram
16 16

14 14

12 12

10 10

8 8

6 6

4 4

2 2

0 0
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
1.Contrast enhancement: Histogram equalization improves the contrast of an
image by redistributing the pixel intensities.

2.Improved dynamic range: It expands the dynamic range of the image,


making details in both dark and bright areas more visible.

3.Adaptive nature: Histogram equalization can adapt to the local characteristics


of an image, making it suitable for varying lighting conditions.
ADVANTAGES
4.Preservation of global image statistics: Histogram equalization preserves the
relative relationships between pixel intensities, preventing the introduction of
artifacts or unnatural effects.

5.Wide range of applications: It finds applications in various fields such as


medical imaging, remote sensing, computer vision, and digital photography.
1.Loss of information: Histogram equalization redistributes pixel intensities
based solely on their frequencies, which can result in the loss of some
information or details in the image. This can lead to a loss of fine textures or
subtle variations in the original image.

2.Amplification of noise: Since histogram equalization stretches the intensity


range, it can also amplify noise present in the image. This means that any noise
or artifacts in the original image may become more pronounced and visible after
histogram equalization.

DISADVANTAGES 3.Unrealistic appearance: In certain cases, histogram equalization can lead to


an unrealistic appearance of the image. This is particularly true when applied to
images with extreme or highly uneven lighting conditions. It may cause
unnatural-looking effects, such as haloing or exaggerated contrast, which can
distort the visual representation.

4.Lack of control: Histogram equalization is a global image enhancement


technique, which means that it treats the entire image as a whole. It may not
offer fine-grained control over specific regions of interest or allow for localized
adjustments. This can be a limitation when dealing with images that require
targeted enhancements.
CONCLUSION
Histogram equalization is a powerful technique used in image processing to enhance the contrast
and overall appearance of an image. By redistributing the pixel intensities, it effectively stretches
the histogram and increases the visibility of details in both dark and bright regions. This method is
particularly useful in various applications, including medical imaging, satellite imagery, and
computer vision.
Histogram equalization offers a simple and efficient way to improve the visual quality of images,
making it a valuable tool in the field of image enhancement. With its ability to enhance details and
improve image interpretation, histogram equalization continues to play a crucial role in various
industries and research domains.
REFERENCES:

1. https://www.tutorialspoint.com/dip/histogram_equalization.htm
2. https://www.mygreatlearning.com/blog/histogram-equalization-explained/
3. https://www.geeksforgeeks.org/histogram-equalization-in-digital-image-processing/
4. https://medium.com/@kyawsawhtoon/a-tutorial-to-histogram-equalization-497600f270e2
5. https://people.ece.ubc.ca/irenek/techpaps/introip/manual02.html
6. https://www.imageeprocessing.com/2011/04/matlab-code-histogram-equalization.html
7. https://www.bogotobogo.com/Matlab/Matlab_Tutorial_Digital_Image_Processing_5_Histogra
m_Equalization_imhist_histeq_imadjust.php

You might also like