image segmentation error (tuple index out of range)
Anurag
anurag.phadke at gmail.com
Fri Jan 8 13:23:53 EST 2016
thx emma + Stefan. Here's my temporary work-around:
Convert to Grayscale, save as JPG, run the code.
-anurag
On Thu, Jan 7, 2016 at 11:59 PM, Emmanuelle Gouillart <
emmanuelle.gouillart at nsup.org> wrote:
> Done!
> https://github.com/scikit-image/scikit-image/issues/1867
>
> On Thu, Jan 07, 2016 at 11:47:14PM -0800, Stéfan van der Walt wrote:
> > Hi, Emmanuelle
>
> > Please file a ticket so that we don't forget about this missing feature.
>
> > Thanks!
> > Stéfan
>
> > On Jan 8, 2016 09:44, "Emmanuelle Gouillart" <
> emmanuelle.gouillart at nsup.org>
> > wrote:
>
> > Hello Anurag,
>
> > my guess is that your image is an RGB image, so that its shape is
> > (n_rows, n_cols, 3). I could reproduce your problem using the RGB
> > astronaut image from scikit-image (data.astronaut()).
> ``threshold_otsu``
> > is not very well adapted to RGB images because it mixes together the
> > color channels by first raveling all pixels. [Note for dev team: this
> > should be better documented, and we should look for a thresholding
> > algorithm compatible with RGB images]
>
> > Therefore ``image > thresh`` is a 3-D array (or 2-D color, you can
> try
> > imshow on this array). You can try determining the threshold value
> on a
> > grayscale image if it's possible for you, using the as_grey keyword
> > argument in io.imread. Or you can determine a threshold for each
> color
> > channel.
>
> > Cheers,
> > Emma
>
>
> > On Thu, Jan 07, 2016 at 09:04:48PM -0800, Anurag Phadke wrote:
> > > Hello,
> > > I am trying to run "image segmentation" on the attached image.
> Code at:
> > > https://gist.github.com/anuragphadke/7eb0e4398ef005632c6d
>
> > > However, on running the above script, i get the following error:
>
> > > Traceback (most recent call last):
> > > File "a.py", line 21, in <module>
> > > bw = closing(image > thresh, square(3))
> > > File
> "/Library/Python/2.7/site-packages/skimage/morphology/misc.py",
> > line 37,
> > > in func_out
> > > return func(image, selem=selem, *args, **kwargs)
> > > File
> "/Library/Python/2.7/site-packages/skimage/morphology/grey.py",
> > line
> > > 122, in func_out
> > > out_temp = func(image, selem, out=out_temp, *args, **kwargs)
> > > File
> "/Library/Python/2.7/site-packages/skimage/morphology/grey.py",
> > line
> > > 349, in closing
> > > dilated = dilation(image, selem)
> > > File
> "/Library/Python/2.7/site-packages/skimage/morphology/misc.py",
> > line 37,
> > > in func_out
> > > return func(image, selem=selem, *args, **kwargs)
> > > File
> "/Library/Python/2.7/site-packages/skimage/morphology/grey.py",
> > line
> > > 251, in dilation
> > > nd.grey_dilation(image, footprint=selem, output=out)
> > > File "/usr/local/lib/python2.7/site-packages/scipy/ndimage/
> > morphology.py",
> > > line 1295, in grey_dilation
> > > sz = footprint.shape[ii]
> > > IndexError: tuple index out of range
>
> > > Any idea what might be wrong here? I tried multiple images and
> multiple
> > file
> > > formats (jpg / png etc.)
>
> > > -anurag
>
> --
> 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/QP6sHolCVgs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> scikit-image+unsubscribe at googlegroups.com.
> To post to this group, send an email to scikit-image at googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/scikit-image/20160108075923.GB3070033%40phare.normalesup.org
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Twitter: @anuragphadke (https://twitter.com/#!/anuragphadke)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20160108/e9a8b99c/attachment.html>
More information about the scikit-image
mailing list