0% found this document useful (0 votes)
10 views3 pages

IP_Lab_2

The document outlines a practical exercise focused on reading an image, displaying its histogram, and applying histogram equalization. It includes objectives, theoretical insights on histogram interpretation, and step-by-step instructions for displaying both the original and equalized histograms using specific functions from the OpenCV and matplotlib libraries. The conclusion emphasizes the successful execution of these tasks for image enhancement.

Uploaded by

srushtis1314
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

IP_Lab_2

The document outlines a practical exercise focused on reading an image, displaying its histogram, and applying histogram equalization. It includes objectives, theoretical insights on histogram interpretation, and step-by-step instructions for displaying both the original and equalized histograms using specific functions from the OpenCV and matplotlib libraries. The conclusion emphasizes the successful execution of these tasks for image enhancement.

Uploaded by

srushtis1314
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Practical No: 02

Problem Statement :
Read any image. Display the histogram, Equalized histogram, and image with equalized
histogram.

Objectives :
1. To learn to plot image in the form histogram and apply histogram equalization.

2. Input: image

3. Output: Image histogram of input and output image, equalized image.

Theory :
What we can explore from Histogram? Why Histogram
equalization?
We can deduce a great deal about the appearance of the image
from its histogram.
i) In a dark image, the gray levels would be clustered at lower ends.
ii) In an uniformly bright image, the gray levels would be clustered
at the upper end.
iii) In a well contrasted image, the gray levels would be well spred
out over much of the image.

Displaying Equalized Histogram of input image:

1. Read and load the grayscale image generated in the


previous step.

2. Obtain the equalized histogram of the grayscale image using


the cv2.equalizeHist() function.
3. Obtain the corresponding histogram which can be displayed
for the equalized histogram using the cv2.calcHist()
function. Set the parameters as set above.

4. Plot the equalized histogram using the matplotlib library.

5. Display the image corresponding to the equalized histogram


using cv2 library.

Note: Ask students to explore the histogram of bright, dark and well
contrast image. Apply histogram equalization on each and compare
the result and do the analysis.

Applications: For image enhancement :

a) Displaying Histogram of input image:

1. Read and load the input RGB image.

2. Convert the image to grayscale using the


cv2.cvtColor() function.

3. Obtain the histogram of the grayscale image using


the cv2.calcHist() function.

Set the following parameters:

Input image

Channels: [0] (since the image is grayscale).

Mask: None (since we require the histogram of the


entire image and not a specific part).

histSize: [256] (represents the bin count; 256 in


case of grayscale image).
range: [0, 256] (the range of values that a pixel can
have).

4. Plot the histogram using the matplotlib library.

Conclusion :
In this way, we have performed display the histogram, Equalized histogram, and image with
equalized histogram.

You might also like