Gaussian Blurring with Python and OpenCV

Tony Flores
Analytics Vidhya
Published in
6 min readMar 22, 2019

--

Introduction

Here we will discuss image noise, how to add it to an image, and how to minimize noise with Gaussian blurring using OpenCV. We have a tiny bit of math to go over, but it’s not entirely imperative for implementing it in Python. If you just want the code, skip to the bottom for a TL;DR.

Gaussian Blur

In image processing, a Gaussian Blur is utilized to reduce the amount of noise in an image. Implementing a Gaussian Blur on an image in Python with OpenCV is very straightforward with the GaussianBlur() function, but tweaking the parameters to get the result you want may require a high level understanding of the mathematics of image noise and the Gaussian blur.

Images as Functions

When people see an image, we see what it represents. We see the image below and we see an adorable puppy made even more adorable by wearing a bow tie. If we observe it more meticulously, we will notice a large amount of green in the background, beige color in the center, and some shades of blue. A computer, however, sees images differently than people do. To a computer, this image is just a large 2-dimensional matrix of numbers. Each number represents the color of a pixel.

Computers can process these 2-D matrices by applying various functions to them to alter the values. Gaussian blurring is one example of this.

--

--