Get border pixels of labelled region
Guillaume Gay
guillaume at mitotic-machine.org
Mon Sep 2 14:28:53 EDT 2013
You should use `io.imread('IMG_1.jpg')` instead of `Image.open`, which
returns an `Image` object, not a numpy array.
Le 02/09/2013 18:25, Payal Gupta a écrit :
>
> code:
>
> import Image
>
> from skimage import segmentation as seg,io
>
> img = Image.open("IMG_1.jpg" , 'r')
>
> bimg =seg.find_boundaries(img)
>
> io.imshow(bimg)
>
>
> error:
>
> Traceback (most recent call last):
>
> File "<stdin>", line 1, in <module>
>
> File
> "C:\Anaconda\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py",
> line 523, in runfile
>
> execfile(filename, namespace)
>
> File "C:\Users\Dell\Documents\Python Scripts\final_try.py", line 12,
> in <module>
>
> bimg =seg.find_boundaries(img)
>
> File
> "C:\Anaconda\lib\site-packages\skimage\segmentation\boundaries.py",
> line 10, in find_boundaries
>
> boundaries = np.zeros(label_img.shape, dtype=np.bool)
>
> File "C:\Anaconda\lib\site-packages\PIL\Image.py", line 512, in
> __getattr__
>
> raise AttributeError(name)
>
> AttributeError: shape
>
>
>
> On Mon, Sep 2, 2013 at 8:27 PM, Stéfan van der Walt <stefan at sun.ac.za
> <mailto:stefan at sun.ac.za>> wrote:
>
> On Mon, Sep 2, 2013 at 4:48 PM, Payal Gupta <erpayal2010 at gmail.com
> <mailto:erpayal2010 at gmail.com>> wrote:
> > but this syntax segmentation.find_boundaries(img) not work
> > where img is an image
>
> Unless you send us a code snippet (e.g. on https://gist.github.com),
> there is nothing we can do to help.
>
> Stéfan
>
> --
> 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/rXRS0KT2PdU/unsubscribe.
> To unsubscribe from this group and all of its topics, send an
> email to scikit-image+unsubscribe at googlegroups.com
> <mailto:scikit-image%2Bunsubscribe at googlegroups.com>.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
> --
> 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/groups/opt_out.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scikit-image/attachments/20130902/1ccdaa2f/attachment.html>
More information about the scikit-image
mailing list