Topic: Salt and pepper noise, also known as impulse noise, refers to noise that appears as if salt and pepper (white and black pixels) has been sprinkled on top of an image. It is often caused by sharp and sudden disturbances in the image signal. The median filter is very effective method for reducing this type of noise, while the running Max and min filters are very efficient in removing only pepper and salt noise, respectively.

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 based on a probability, corrupts the image with salt and pepper noise. Then the noise image is returned. Create two similar functions, one for only salt noise and one for only pepper noise. You can add any extra parameters you desire.
  • Read an image.
  • Corrupt the image with any of these noise types.
  • Finally, display the original image alongside the noise 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: 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