Box (Mean) Filter
Last updated
Last updated
But what the heck is Mean filter? will it tell me to shut up? Well no. You might be familiar with the mathematical mean, which looks like so
or a less obtuse way to imply the same
Mean filter works by assigning the current pixel to the mean of all its surrounding pixels, which effectively results in a blurred effect.
The Box (Mean) filter is implemented at src/smoothing/box.c, Let's take a deeper look at it.
As expected we loop through every pixel, more specifically every channel within the image, and for each we compute their mean, we can do via a simple function
My apologies if this code isn't very clear, all we doing is for the index provided, we sum up the next N values to it's right and below (where N = kernSize = size).
And that is it. So are we done? Is the problem of blurring things solved? No, this filter has some shortcomings, notably.
it can't distinguish sharper features within the image as relevant, it instead applies a uniform blur over the entire image
Which is why we need the Gaussian Blur let's see it further next.