[SciPy-user] PIL and gaussian_filter?

Stéfan van der Walt stefan at sun.ac.za
Wed May 21 17:04:36 EDT 2008


Hi Johannes

2008/5/21 Johannes Strömberg <johannes.stromberg at gmail.com>:
> Thanks a lot, it works like a charm.
>
> Does anyone know of an efficient way of implementing a threshold
> filter, i.e. where the resulting value is either the difference
> between the current value and the threshold (if the value is above the
> threshold) or otherwise 0?

Unless you have really large data-sets, you can do:

mask = x > threshold
x[~mask] = 0
x[mask] -= threshold

Regards
Stéfan



More information about the SciPy-User mailing list