Lab Assignment
Histogram Equalization of a Grayscale Image
You are required to write a Python program that performs histogram equalization on a given grayscale
image without using any inbuilt histogram functions. The implementation should follow a modular
approach where each step is implemented in a separate function.
Complete the following tasks:
1. Load and Display Input Image
2. Compute Histogram
Write a function to compute the frequency of occurrence for each pixel intensity level
manually by iterating through pixels.
Display the original image histogram using Matplotlib.
3. Compute PDF (Probability Distribution Function)
Write a function to compute the PDF and display it.
4. Compute CDF (Cumulative Distribution Function)
Write a function to compute the CDF from the above PDF and display it.
5. Generate Transformation Mapping
Write a function to generate the mapping from original intensity to new equalized intensity
and display the intensity mapping.
6. Apply Histogram Equalization
Write a function to apply the transformation to all pixels of the input image to obtain the
equalized image.
Display the original and equalized image side by side.
7. Compute and Display Equalized Histogram
Compute the histogram of the equalized image manually.
Display the original and equalized histogram.
8. Apply histogram equalization using inbuilt function and compare the resulting image and histogram
with the manually equalized image and its histogram.