Get the mask for a contour

Francesc Alted francesc at continuum.io
Mon Feb 25 09:53:14 EST 2013


On 2/25/13 1:34 PM, St�fan van der Walt wrote:
> 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

Yes!  _pnpoly.grid_points_inside_poly() is what I need, but I can see 
points_inside_poly() being useful too.  I'm working on a PR for making 
these public, but I'm currently getting an error when trying to process 
the docs:

```
doc/$ make
[clip]
Making output directory...
Running Sphinx v1.1.3
/Users/faltet/anaconda/lib/python2.7/site-packages/matplotlib/__init__.py:1005: 
UserWarning:  This call to matplotlib.use() has no effect
because the the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

   warnings.warn(_use_error_msg)
loading pickled environment... not yet created
loading intersphinx inventory from 
http://scikit-learn.org/stable/objects.inv...
loading intersphinx inventory from 
http://docs.scipy.org/doc/scipy/reference/objects.inv...
loading intersphinx inventory from 
http://docs.scipy.org/doc/numpy/objects.inv...
loading intersphinx inventory from http://docs.python.org/2.7/objects.inv...

Exception occurred:
   File "<string>", line 6, in <module>
ImportError: No module named rank
The full traceback has been saved in 
/var/folders/2q/970l17jj7sl3mb_jgmmrnw2r0000gn/T/sphinx-err-XyEnG6.log, 
if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error 
message can be provided next time.
Either send bugs to the mailing list at 
<http://groups.google.com/group/sphinx-dev/>,
or report them in the tracker at 
<http://bitbucket.org/birkenfeld/sphinx/issues/>. Thanks!
make: *** [html] Error 1
```

I'm using Python 2.7.3 and Sphinx 1.1.3.  Any hints on this?

Thanks!

-- 
Francesc Alted




More information about the scikit-image mailing list