Search code examples
pythonalgorithmopencvimage-processingdefinition

What is aplha-trimmed mean filter?


I understood mean filter which is taken the mean value of kernel pixels and also I understood median filter which takes median value of kernel pixels( sorted all values and take the mid value of the kernel).

Alpah-trimmed mean filter gives a mixture of the mean and median filters. and the output is

Equation of output pixel from filter

I couldn't understand what's going on this filter. Can anyone explain this filter clearly?


Solution

  • This filter is a combination of mean filter and median filter as you said. First, we look at where we can use this filter. It performs reasonably well in the presence of both Gaussian and outlier noise.

    This is an algorithmic approach that tries to combine properties of the mean filter with properties of the median filter. It has a parameter called P which determines how much of the mean filter and how much of the median filter is going to apply.

    playing around with p, you can get the best out of both median and mean hybrid combinations.

    When your image has gaussian noise + outlier noise(salt and pepper noise) that time you can go with a median filter to remove Gaussian noise then go with a median filter/ min filter/max filter to remove the outlier noise. but in this approach, we need to go with more kernel processing so this is computationally very demand.

    In that case, we can go with the alpha-trimmed mean filter what it does, It first applies the median filter. selecting a median window rather than a single value (a particular window centred around the median value) and then do mean filtering on that part. If your median window is small, it will look like a simple median only. 5 * 5 window, put it in an array size of 25. if you apply the median only you will select the midpoint only but here what we are doing here is around the midpoint we select a window ( 5 elements of array center is the mid point) and apply mean filtering to the window. With the parameter P, we can decide how much we need to apply for median and mean filter.

    If we reduce the P, the window size is taken for the mean filtering will be heigh and we increase the mean filter effect. If we increase the P, the window size is taken for the mean filtering will be reduced based on that, we increase the median filter effect.

    What here we have done is, first we apply the median filter to the image and get the median pixel place then we take a window around the median pixel value and we apply a mean filter to that window. Basically, the mean filter window size is depended on p when we increase the p the window size will reduce so the mean filter effect will reduce and vice versa as well

    Consider below window size

    | 20 20 8|

    |21 19 12|

    |19 22 10|

    The ordered list is { 8, 10, 12, 19, 19, 20, 20, 21, 22}

    For different values of p, the output is as follows:

    0 - 16.8

    1 - 17.3

    2 - 18.0

    3 - 19.3

    4 - 19.0

    The first thing that we have done is we get the median window. Then we ordered the pixels depending on the p-value, Our value is changed from the mean value of the window to the median value of window(16.8 to 19.0)