Topic: The weighted median filter is a variation of the standard median filter that utilizes a kernel that contains weights in order to de-noise an image. These weights, if chosen properly, can incorporate time information in their structure. For example, it is a good idea to weigh the central pixels in the filter window more heavily that the others.

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

  • Import OpenCV and NumPy libraries.
  • Create a function that takes as input the size of the weighted median filter and creates its kernel.
  • Create a function that takes as input an image and the weighted median kernel and performs weighted median filtering on the image. Then, it returns the filtered image. It should use 0-padding in order to prevent the creation of black borders in the image. You can add any extra parameters you desire.
  • Read an image.
  • Corrupt the image with any type of noise you desire.
  • Apply weighted median filtering to the noise image.
  • Finally, display the noise image alongside the filtered one.

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

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

Lecture for better understanding: https://icarus.csd.auth.gr/image-filtering-lecture/

This exercise was developed by C. Georgiadis.

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

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