Topic: Histogram equalization is a very useful image processing technique that modifies the histogram of an image in order to increase its contrast. While most of the time the output image has subjectively better quality than the original, this method also tends to amplify noise.

Exercise: Create a Python script file and perform the following tasks:

  • Import OpenCV and NumPy libraries.
  • Create a function that takes as input an image and calculates its histogram, which is then returned. You can add any extra parameters you desire.
  • Create a function that takes as input a histogram and calculates its cumulative sum (cdf). You can add any extra parameters you desire.
  • Create a function that takes as input an image and the cdf of its histogram and applies histogram equalization on the image. Then, return the equalized image. You can add any extra parameters you desire.
  • Read an image.
  • Calculate its histogram and the cdf.
  • Plot the histogram along with its cdf.
  • Apply histogram equalization on the image.
  • Calculate the histogram of the equalized image and the cdf.
  • Plot the equalized histogram along with its cdf.
  • Finally, display the original image alongside the equalized one.

Instructions  and Material for solution: Click Image to download the exercise material.

Help (if needed): Click Pdf to download the exercise help.

Lecture for better understanding:  http://icarus.csd.auth.gr/digital-image-processing/

This exercise was developed by C. Georgiadis.

————————————————————————————————————–

For the solutions to the exercises, please contact koroniioanna@csd.auth.gr