Noise Filtering
Filtering
Filtering is a neighbourhood operation:
- The output pixel is a function of neighbourhood pixels.
Linear Filtering
The output pixel is a linear combination of input pixels.
We use a mask that contains weights to be assigned to each pixel:
- The operation is applies to every pixel by sliding the mask.
- The output pixel is the sum of the input pixels multiplied by the weights in the mask.
Non-Linear Filtering
Anything that is not linear:
- Square mean of neighbourhood pixels.
- Median of neighbourhood pixels.
Mean Filtering
The idea is to take an average of all $N8$ pixels:
- The filter has equal weights across all pixels in the neighbourhood.
Mean filtering is good to remove Gaussian noise.
The original data of the image is modified.
When averaging pixels on the edges of the image, non-existent pixels are treated as 0.
Linear Filtering, Cross-Correlation & Convolution
Linear filtering is the same as cross-correlation of two signals.
Convolution is the same as cross-correlation by the kernel is rotated by 180 degrees.
Median Filtering
This is the same as mean but the median of neighbourhood pixels instead of average.
Requires sorting of $N8$ weighted pixel value.
This is good for salt-and-pepper noise and preserves edges.
Gaussian Filtering
The mask is obtained using the following equation:
\[G_\sigma=\frac1{2\pi\sigma^2}e^{-\frac{(x^2+y2)}{2\sigma^2}}\]we substitute in $(x,y)$ of the mask pixel to find it’s value.
The degree of smoothing is controlled by both the mask size and $\sigma$.
This filter produces a good output for use with edge detection algorithms.