Filtering
Because shape is the keyword in mathematical morphology, we can avoid some side effects caused by other types of filters. The edges are kept sharp while removing noise.
An example:
The left figure is our original image.
In the right we have added some Gaussian noise (mean µ = 0 and variance
var
= 0.01).
The next left image has been treated with some morphological filters: first
we performed a so called opening by reconstruction, followed by a closing
by reconstruction; then we used an alternating filter (a closing
followed by an opening). The structuring element here is always a cross.
The right
figure is the result after filtering with a Gaussian filter (hsize =
[3
3]; sigma = 1).
Although the Gaussian filter does its job of reducing the number of noise speckle, the shape of the objects are now blurred, while the morphological filter preserves the sharp edges of the objects in the image.