Get the mask for a contour

Stéfan van der Walt stefan at sun.ac.za
Mon Feb 25 07:34:04 EST 2013


Hi Francesc!

On Mon, Feb 25, 2013 at 1:57 PM, Francesc Alted <francesc at continuum.io> wrote:
> This is my first post here :)  I'm using scikits image for getting some

Welcome :)

> features from images.  What I'd like is, given a contour as a serie of dots,
> how can I mask (to zero) the points outside the contour?

There happens to be an implementation of that both in scikit-image and
in matplotlib.  We use it only internally at the moment, so it is
exposed as:

from skimage._shared.geometry cimport point_in_polygon

and (with a slightly more Pythonic interface) as

skimage.morphology._pnpoly

If you think it's useful on a more general level, a pull-request to
expose it would be very welcome!

Best,
Stéfan



More information about the scikit-image mailing list