[Numpy-discussion] A faster median (Wirth's method)
Thu Sep 3 00:28:19 CDT 2009
On Thu, Sep 3, 2009 at 00:09, Sturla Molden<firstname.lastname@example.org> wrote:
> Chad Netzer skrev:
>> I'd also like to, if possible, have a specialized 2D version, since
>> image media filtering is one of my interests, and the C version works
>> on 1D (raveled) arrays only.
> I agree. NumPy (or SciPy) could have a select module similar to the sort
> module. If the select function takes an axis argument similar to the
> sort functions, only a small change to the current np.median would needed.
> Take a look at this:
> Here is a select function that takes an axis argument. There are
> specialized versions for 1D, 2D, and 3D. Input can be contiguous or not.
> For 4D and above, axes are found by recursion on the shape array. Thus
> it should be fast regardless of dimensions.
When he is talking about 2D, I believe he is referring to median
filtering rather than computing the median along an axis. I.e.,
replacing each pixel with the median of a specified neighborhood
around the pixel.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion