Consider the kernel below, in which all values equal 1. This means that the values of the nine pixels in the neighbourhood are summed. Subsequently, the result is divided by 9 to ensure that the overall pixel values in the output image are in the same range as the input image. In this situation the gain is 1/9 = 0.11. The effect of applying this averaging filter is that an image will become blurred or smoothed. This filter could be applied to radar images to reduce the effect of speckle. In this kernel, all pixels contribute equally to the result.
1 | 1 | 1 |
1 | 1 | 1 |
1 | 1 | 1 |
It is also possible to define a distance-weighted average instead of an arithmetic mean: the larger the pixel’s distance from the centre of the kernel, the smaller the weighting. As a result, less drastic blurring takes place. The resulting kernel, for which the gain is 1/16 = 0.0625, is:
1 | 2 | 1 |
2 | 4 | 2 |
1 | 2 | 1 |