Is there a problem with the function points_in_poly ? measure.points_in_poly

Julien Derr julien.derr at gmail.com
Thu Dec 4 13:25:50 EST 2014


Thanks to both of you for your quick reply!  and yes Johannes, you are
right!! it works the way you say!

sorry for bothering you for this mistake of mine! I am not very good at
convention, I thought my array was a (1,2) (1 line and two columns, so N=1)
bu I think I understand now!

thanks!


On Thu, Dec 4, 2014 at 7:19 PM, Johannes Schoenberger <jsch at demuc.de> wrote:

> The docs say `points` must be a (N, 2) array. You pass a (2, ) array.
>
> Make it: ``skimage.measure.points_in_poly(np.array([[0,0]]),cont2)``
>
> > On Dec 4, 2014, at 1:05 PM, Julien Derr <julien.derr at gmail.com> wrote:
> >
> > Hi everyone,
> >
> > I would like to use the function points_in_poly to test if the point x,y
> is in the contour cont2
> > x=0 y=0, but I have the problem with any value of x and y:
> >
> > skimage.measure.points_in_poly(np.array([x,y]),cont2)  where cont2 is a
> contour of type  array :
> > but I get the following error:  "IndexError: invalid index"
> >
> > it is a little obscure for me, is there a problem with this function, or
> is it me who don't know how to apply it ?
> >
> > thanks a lot!
> >
> > Julien
> >
> >
> >
> >
> > cont2        ndarray    7879x2: 15758 elems, type `float64`, 126064
> bytes (123 kb)
> >
> > In [12]: skimage.measure.points_in_poly(np.array([0,0]),cont2)
> >
> ---------------------------------------------------------------------------
> > IndexError                                Traceback (most recent call
> last)
> > /home/julien/Dropbox/density_seiche/<ipython-input-12-2271d0f2b0ba> in
> <module>()
> > ----> 1 skimage.measure.points_in_poly(np.array([0,0]),cont2)
> >
> >
> /usr/local/lib/python2.7/dist-packages/scikit_image-0.11dev-py2.7-linux-x86_64.egg/skimage/measure/_pnpoly.so
> in skimage.measure._pnpoly.points_in_poly (skimage/measure/_pnpoly.c:2397)()
> >
> > IndexError: invalid index
> >
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "scikit-image" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to scikit-image+unsubscribe at googlegroups.com.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "scikit-image" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/scikit-image/44_uNlLqqhE/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> scikit-image+unsubscribe at googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20141204/4a7a3e6f/attachment.html>


More information about the scikit-image mailing list