We can have a sliding window to add new pixels in while removing some old pixels to slide through each support region. The median can be found by maintaining a max heap and min heap and try to balance two heaps.
However, in which case a median filter is preferred over other filters for blurring? Like bi-linear filter is good for smoothing, and motion filter is good for motion blur. I think there's must be a reason why people come up with this one.
mithrandir
Median filtering is great for removing salt & pepper noise. If you apply a blurring technique to an image with salt and pepper noise you end up just diffusing the erroneous high/low values into the surrounding pixels.
With the median filter, you can effectively generate an estimate for what value should replace the white/black pixels.
We can have a sliding window to add new pixels in while removing some old pixels to slide through each support region. The median can be found by maintaining a max heap and min heap and try to balance two heaps.
However, in which case a median filter is preferred over other filters for blurring? Like bi-linear filter is good for smoothing, and motion filter is good for motion blur. I think there's must be a reason why people come up with this one.