# Different Types of Image Processing – Mean, Median and Laplace Rule

When it comes to processing images, there are a couple of ways to smooth sharp edges, remove the noise from an image and find the edges too. Physics AS requires you to know how to image process a given image and understand why people process images. I will go over the main types of image processing here: mean, median and finding the edges using the Laplace rule.

Mean
The mean is used to smooth sharp edges and soften the image.
Rule – Replace each pixel by the mean of its value and those of it’s neighbours.

In the above example, there are 9 pixels: the surrounding pixels showing the ‘100’ with the centre showing ’50’. To smooth this image with the mean, add the total sum of the pixels (850) and divide it by nine. That number being 94 is the new number of the centre pixel. On a picture, this will smooth the sharp edges. It is also important to use the original values of the pixels when calculating the mean of other pixels. For example, for any of the surrounding ‘100’ pixels, use the centre’s value at 50 and not 94 calculating the mean.
Median
The median is used to remove noise (more known as ‘background noise’) from an image. Noise arises from random fluctuations which may degrade a signal or image.
Rule – Replace each pixel by the median of its value and those of its neighbours.
In the same example as above where the centre pixel is 50 (and can be seen as an anomalous pixel or background noise), by calculating the median of the surrounding and centre pixel makes the new value of the centre pixel 100.
This is why the median is better at removing random background noise than the mean. The mean produced a value of 94 which doesn’t reduce all the noise when the median produced a value of 100 removing all noise.
At the same time, this is why the mean is better as smoothing edges better than the median. The mean’s value makes the image softer at edges while the median erases the edge all together (if not, maintains the sharp edge).
Laplace Rule
The Laplace rule detects changes in the gradient of the brightness. It also helps identify where the edges are in the image.
Rule – Subtract the North, South, East and West neighbours of the pixel from four times the value of centre pixel.
If you can’t read the text in the image, just click on the image and a bigger version of it will appear. Anyway, I hope the image is self-explanatory. If not, well the Laplace rule helps makes us realise where the edges are in an image and detects changes in the gradient of brightness (kind of the same thing). The results from doing the Laplace rule on each centre pixel above makes it either 0, positive or negative. From the diagram below it, you can clearly see where the edge is (at the 0).
I hope this has proved useful to you. Also, please check out some of my other articles. I have done revision help and information for many different aspects of Physics.