Gaussian Filter
Last updated
Last updated
The Gaussian blur is one of the most popular blurring algorithms, where even applications like Photoshop and Gimp use it as their primary implementation. The Gaussian blur applies the Gaussian or Normal distribution which is a function in statistics which distributes values given a N
across a bell curve, over the pixel values contained within the kernel.
yet again let's unpack this
What this function is essentially doing is giving us some value which is contained within a "bell curve" ; this curve is determined by the SIGMA and the MEAN. If this sounds too complicated, it's because it is, so let's jump into the code to see what's going on.
The Gaussian filter is implemented at src/smoothing/blur.c Let's take a deeper look at it.
Stay with me here - We have a kernel of N
size, we go through each cell of the kernel and assign a value, we compute this value from sigma
modifier along with the X, and Y coordinates of the pixel.
We then multiply the kernels's value from the neighbours of the current pixel. After this point the process is similar to the Mean filter where we sum all the (weighted) values that come within kernel bounds and divide them. That produces the following output.
The Gaussian Blur is similar to the Box or Mean filter except a sigma
modifier allows us to control how "sharp" the blur is.