# Fuzzy filters

Noise reduction in images is one of the common tasks in image processing. I present several fuzzy filters using fuzzy logic concept. There are several symmetrical and asymmetrical triangular membership functions with both median and moving average centre used for filtering impulse and random noise.

On the left is the image with random noise. In turn, on the right with 'salt and pepper' noise. In presented simulations, I used 8-bit mono images of dimension (M\times N) ((512\times512)) pixels with added impulse noise with density value 0.02. For Gaussian I used the following settings: mean = 0, $\delta$ = 0.05.

Gaussian fuzzy filter with median centre (GMED) is defined as:

where $x_{med}(i,j)$ and $\delta(i,j)$ represent respectively, the median value of all the input values $x(i+s,j+t)$.

Here, I present the usage of GMED filter for K=1.

Symmetrical triangle fuzzy filter  with median centre (TMED) is present below:

where $x_{mm}(i,j) = max [x_{max}(i,j) - x_{med}(i,j), x_{med}(i,j) - x_{min}(i,j)]$ $x_{max}(i,j), x_{min}(i,j)$ and $x_{med}$ are respectively the maximum, minimum and median value of all the input values within squared window at indicies $(i,j)$.

So now, I present the usage of TMED  filter for K=1.

Asymmetrical triangle fuzzy filter  with median centre (ATMED) is present here:

Below, a pair of images.  On the left - with noise, on the right with applied ATMED filter.

Symmetrical triangle fuzzy filter with average centre (TMAV) is present below:

where $x_{mv}(i,j) = max [x_{max}(i,j) - x_{mav}(i,j), x_{mav}(i,j) - x_{min}(i,j)]$

$x_{max}(i,j), x_{min}(i,j)$ and $x_{mav}$ are respectively the maximum, minimum and average value of all the input values within squared window at indicies $(i,j)$.

Here, I present the usage of TMAV filter for $K=1$.

Asymmetrical triangle fuzzy filter  with moving average centre (ATMAV) is present here:

The difference between $x_{mav}(i,j)-x_{min}(i,j)$ and $x_{max}(i,j)-x_{mav}(i,j)$ defines the degree of asymmetry. $x_{max}(i,j), x_{min}(i,j)$ and $x_{mav}$ are respectively the maximum, minimum and average value of all the input values within squared window at indicies $(i,j)$.
Below, I show the application of ATMAV filter.

Decreasing weight fuzzy filter with moving average centre (DWMAV) is present here:

where $-T \leq t \leq T$ and $-S \leq s \leq S$, and $2T +1 = 2S + 1 = K$. $K$ is width of square window, $r$ is the threshold value and it defines the height of decreasing triangular shape weighted function, $t = |T|, s=|S|, r= 1,2,3$.

Finally, I present the usage of DWAM filter for $K=1, r=1$