# [Image Processing] Gaussian blur

## Definition

Gaussian blur is used in image processing to blur images. In most of the cases, this is done with the sole purpose of removing noise, but it is also necessary to take some care to its two different parameters. Depending on this two parameters, the result will vary. These two parameters are the size of the kernel and sigma.

In order to calculate the kernel that will be used to convolve the picture, we need to use the Gaussian formula for two dimensions, which is the following:

Let us say that we want to generate a kernel of size 7 with .
X and Y values are determined by the position of each element in the matrix.

Finally, the values are:

 6.7e-07 2.292e-05 0.00019117 0.00038771 0.00019117 2.292e-05 6.7e-07 2.292e-05 0.00078634 0.00655965 0.0133037 0.00655965 0.00078633 2.292e-05 0.00019117 0.00655965 0.0547216 0.110982 0.0547216 0.00655965 0.00019117 0.00038771 0.0133037 0.110982 0.225084 0.110982 0.0133037 0.00038771 0.00019117 0.00655965 0.0547216 0.110982 0.0547216 0.00655965 0.00019117 2.292e-05 0.00078634 0.00655965 0.0133037 0.00655965 0.00078633 2.292e-05 6.7e-07 2.292e-05 0.00019117 0.00038771 0.00019117 2.292e-05 6.7e-07

The algorithm may be something like this:

Given kernel’s size and generate a kernel
Iterate over rows
Iterate over columns
Convolve the windowed region with the generated kernel
Write that value on the output picture

## Results

 Original
 , kernel’s size = 7
 , kernel’s size = 7
 , kernel’s size = 3

To make it easier, I used a black and white picture, but for color pictures we just need to do the same through the different channels.
It is possible to avoid the darkening of the images by normalizing output pixels during the process.

## References

1. M. Nixon and A. Aguado. 2008. “First order edge detection operators”, Feature Extraction & Image Processing.
2. Wikipedia, http://en.wikipedia.org/wiki/Gaussian_blur

#### lipman

"The only way to proof that you understand something is by programming it"