[SciPy-user] PIL and gaussian_filter?
Stéfan van der Walt
Wed May 21 16:42:00 CDT 2008
2008/5/21 Anne Archibald <firstname.lastname@example.org>:
> 2008/5/21 Stéfan van der Walt <email@example.com>:
>> 2008/5/21 Johannes Strömberg <firstname.lastname@example.org>:
>>> 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
> Or if you want it inplace:
That's a good idea. It is faster than `where`, too.
More information about the SciPy-user