PrerequisitesBefore starting this lesson, you should be familiar with:
Learning ObjectivesAfter completing this lesson, learners should be able to:
Understand in detail what happens when applying a median filter to an image
The median filter is a rank filter and is one of the most popular filters for reducing noise in microscopy images. While the median filter has indeed many good properties, it should be - like any other filter - used with care and a good understanding of its properties.
Median filter exploration
Explore the effect of the median filter on various example images. Explore how changing the size (structural element) of the filter affects the result.
- Observe how the median filter can remove small objects while preserving edges of larger objects.
- Observe that the median filter is not edge-preserving for curved edges.
- Observe how the median behaves in the prescence of noise.
- Observe how the median filter can remove small internal structure from larger objects.
- Observe how the median filter behaves for binary images.
Show activity for:
True or false?
- Median filter is just another name for mean filter.
- Small structures can completely disappear from an image when applying a median filter.
- Median filter is just another name for mean filter. FALSE
- Small structures can completely disappear from an image when applying a median filter. TRUE
Properties of median filter
The median filter is based on ranking the pixels in the neighbourhood
In general, for any neighbourhood filter, if the spatial extend of the neighbourhood is significantly (maybe three-fold) smaller than the smallest spatial length scale that you care about, you are on the safe side.
However, in biology, microscopy images are often containing relevant information down to the level of a single pixel. Thus, you typically have to deal with the fact that filtering may alter your image in a significant way. To judge whether this may affect your scientific conclusions you therefore should study the effect of filters in some detail.
Although a median filter typically is applied to a noisy gray-scale image, understanding its properties is easier when looking at a binary image.
From inspecting the effect of the median filter on above test image, one could say that a median filter
- is edge preserving
- cuts off at convex regions
- fills in at concave regions
- completely removes structures whose shortest axis is smaller than the filter width
Recommended follow-up modules: