efficient running median

Paul Rubin http
Wed Oct 14 00:13:22 CEST 2009

Janto Dreijer <jantod at gmail.com> writes:
> Well, I don't have a lot of theoretical reasoning behind wanting to
> use a median filter. I have some experience applying it to images with
> very good results, so that was the first thing I tried. It felt right
> at the time and the results looked good.

If this is image data, which typically would have fairly low
resolution per pixel (say 8-12 bits), then maybe you could just use
bins to count how many times each value occurs in a window.  That
would let you find the median of a window fairly quickly, and then
update it with each new sample by remembering the number of samples
above and below the current median, etc.

More information about the Python-list mailing list