The middle filter (rectangular core) is optimal for reducing random noise in the spatial domain (image space). However, the middle filter is the worst filter for the frequency domain, with little ability to separate one frequency range from another. The Gaussian filter has the best performance in the frequency domain.
The middle filter is the least effective among low pass filters. Ideally, it should stop high frequencies and pass only low frequencies. In fact, it misses a lot of high frequencies and stops some of the low frequencies (slow rolling and weak attenuation attenuation).
What does this mean in practice? The medium filter is fast and probably the best solution if you want to remove noise from the image. This is a bad decision if you want to separate the frequencies present in the image.
The interesting thing is that you can use the Gaussian filter using the middle filter. If you apply the middle filter twice to the image, you get the same result as applying the filter of triangular cores. If you apply the average filter 4 times to the image, you will get the same result as applying the filter of the Gaussian core.
Gaussian filter uses convolution and is very slow. If you implement a medium filter using a recursive formula, it will work like lightning. By applying the medium filter many times, you can speed up the implementation of Gauss 1000 times.
To answer your question. The middle filter and the Gaussian filter give similar results when removing noise from the image. A Gaussian filter separates frequencies much better. The best filter for this task is the Windowed Sinc filter.
source share