Mlip Pa-1
Mlip Pa-1
Programming Assignment-1
Objective: The objective of this programming assignment is to provide hands-on practice to students
on contrast stretching, histogram equalization, Adaptive Histogram Equalization (AHE), and Clipped
AHE for image enhancement.
Note: Report results on all the given images for each problem. Write your own Python function for
computing the histogram of a given input image and use it in the following problems instead of the
built-in histogram function. Submit a report of the results along with your code.
1. Contrast Stretching: Write your own Python function to perform contrast stretching of an
image. Apply it on all four images. Clearly specify your inferences from these results.
2. Histogram Equalization (HE): Write your own Python function to perform global histogram
equalization of an image. Apply it on all four images. Clearly specify your inferences from these
results.
3. Adaptive Histogram Equalization (AHE): Write your own Python function to perform sliding
window adaptive (local) histogram equalization. For each of the four images, play with varying
window sizes, and only present results for that window size that looks visually better. Also,
make sure to mention the respective window sizes. Clearly specify your inferences from these
results.
a) Define a square window of appropriate size whose centre moves from pixel to pixel.
b) Compute local histogram for each window, and apply histogram equalization for the
central pixel.
c) The pixels at the borders can remain the same and thus no image padding is required.
4. Clipped AHE: Use Python built-in functions to perform clipped AHE for all four images.
Experiment with all parameters of the function, and present the visually best results for each
image along with the details of the respective parameters. Clearly specify your inferences from
these results.