machinevisiontoolbox.Image.medianfilter
- Image.medianfilter(h=1, **kwargs)
Median filter
- Parameters:
h (int, optional) – half width of structuring element, defaults to 1
kwargs – options passed to
rank
- Returns:
median filtered image
- Return type:
Image
instance
Return the median filtered image. For every \(w \times w, w=2h+1\) window take the median value as the output pixel value.
Example:
File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/scipy/ndimage/_filters.py", line 1379, in rank_filter return _rank_filter(input, rank, size, footprint, output, mode, cval, File "/opt/hostedtoolcache/Python/3.9.16/x64/lib/python3.9/site-packages/scipy/ndimage/_filters.py", line 1293, in _rank_filter raise RuntimeError('filter footprint array has incorrect shape.') RuntimeError: filter footprint array has incorrect shape.
- Note:
This filter is effective for removing impulse (aka salt and pepper) noise.
- References:
Robotics, Vision & Control for Python, Section 11.5.3, P. Corke, Springer 2023.
- Seealso: