morphology.label() bug?

karoyakani tj.takei at gmail.com
Thu Dec 22 01:39:21 EST 2011


On Dec 21, 2:02 pm, Stéfan van der Walt <ste... at sun.ac.za> wrote:
...
> I don't like having background == 0, but I'll settle for background ==
> -1 as a default.

Thanks!


> > Regarding connectedness, both matlab and ndimage have options of 8-
> > connect and 4-connect.
...
>
> That's been added in the patch I proposed.

Thanks!!


> > Regarding number of labeled regions (not counting the background
> > regions), again matlab and ndimage compute and return it.
...
>
> This is a one-liner: len(np.unique(labels))

Or, len(np.unique(labels)) - 1, if we do not count the background in.
I tend to think that is a norm when we consider the background
special.
Yet who cares if the output does not include the number of regions.

Regards,
TJ



More information about the scikit-image mailing list