Topic: Gaussian smoothing, or blurring, is a convolutional filter that is used to “blur” an image in order to remove noise. It does a poor job in preserving image details. It utilizes a kernel representing a Gaussian curve, which is normalized. Usually, its mean (μ) is set to 0.


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 a kernel and calculates the 2D convolution of the two matrices. Then, it returns the convolved 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.
  • Create a function that takes as input an image, the size of the Gaussian kernel and the sigma of the Gaussian distribution, and creates the Gaussian kernel. Then, return the filtered image, i.e., the given image convolved with the Gaussian kernel. You can add any extra parameters you desire.
  • Read an image.
  • Corrupt the image with any type of noise you desire.
  • Apply Gaussian smoothing 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