Non-linear filter excellent for removing salt-and-pepper noise while preserving edges. Definition Replace each sample with the median of its neighborhood:
$$ y[n] = \text{median}\{x[n-k], \ldots, x[n], \ldots, x[n+k]\} $$Implementation 1from scipy import signal, ndimage 2import numpy as np 3 4# 1D median filter …
Read More