Mean filtering
Mean filtering is an image processing methodology for removing high frequency noise from images.
The methodology works by moving a window across an image a data point at a time. In our case the image is stored in a 2D array so that's what we move across. The window is large enough to encompass a neighbourhood of data cells. Each data cell is adjusted so that it is the mean value of its neighbourhood (its current value is included in the neighbourhood).
Plainly as we're moving across an array, if we adjusted the array with the data in it we'd be altering points that later went to be neighbours of other points, so, infact, a second array is generated containing the altered results.
Take the following example:
For the first cell "2", we sum the values of the neighbours and the cell, and find out what the mean value is. The int mean in this case is "13", so we keep this in the results array. We then move to the next cell: the "35" cell. The mean of its neighbourhood is "16", so we keep this. And so on.
We would repeat this for all cells in the array, or some internal subset, depending on how we want to resolve the boundary issues (see lecture 3). The resulting array is then our filtered dataset.
Here we are using a "Moore Neighbourhood" - that is, a square neighbourhood around the chosen cell, however, there are other types of neighbourhood. Here the Moore Neighbourhood has a radius of one, that is, there is one cell taken on either side of the central, chosen, cell.