each_channel decorator

Stéfan van der Walt stefan at sun.ac.za
Wed Oct 17 16:37:03 EDT 2012


On Wed, Oct 17, 2012 at 7:39 AM, Schönberger Johannes
<hannesschoenberger at gmail.com> wrote:
> Sounds good. Do you have a paper or any reliable source about this? Just interested in this...

The question is, should we make this a decorator, or simply provide it
as utility functions?  I'm wondering, because now we already have two
different ways of handling color images: split them up, RGB, or
convert them to LAB and apply the filter to LAB.  How do we expose
both of these sensible alternatives to the user?

We can have a *default*, so that all single-channel filters are done
on the luminance layer, but then combine that with utility functions.
E.g.

@luminance_filter
def gray_filter(image, ...):
    ...

gray_filter(color_image, params) --> convert to LAB, filter on L, convert back
filter_layers(color_image, gray_filter, params) -> filter each layer
separately and combine

Alternatively, skip the decorators completely, and just provide two
utility functions: filter_layers and filter_luminance.

Let's hear what the API artists have to say :)

Cheers
Stéfan



More information about the scikit-image mailing list