How to denoise an image in Google Colab

Tracyrenee
2 min readFeb 6, 2024

I have been studying denoising images for several days now, and have decided to post about what I have learned so far. To begin with, I learned the library cv2 does not work on Google Colab, which is the website that I normally use to write code in Python. Therefore, a patch needs to be used in place of cv2, being cv2_imshow.

The code below shows which libraries need to be imported to be able to denoise an image in Google Colab, being:-

  1. Cv2 for computer vision,
  2. Numpy to perform numerical computations,
  3. Cv2_imshow, which is a patch that makes it possible to view images in Google Colab.

I have a picture of my deceased father in my Google account, so decided to read and show it:-

This is a good picture of my dad. I have been told that he looked like James Dean:-

In order to denoise the images, I had to:-

  1. Convert it to gray,
  2. Blur it with a Gaussian function,
  3. Smooth the image,
  4. Divide the image by 255, and
  5. Sharpen the image using masking.

--

--

Tracyrenee

I have five decades experience in the world of work, being in fast food, the military, business, non-profits, and the healthcare sector.