[SciPy-User] ndimage/morphology - binary dilation and erosion?

Tony Yu tsyu80 at gmail.com
Sun May 6 08:24:53 EDT 2012


On Sun, May 6, 2012 at 4:49 AM, klo uo <klonuo at gmail.com> wrote:

> > (http://luispedro.org/software/pymorph#see-also):
> >
> > "mahotas is another Python image processing package, but most of its
> > functions are in C++. It is, therefore, much faster for the operations
> > it supports."
> >
>
> Skeletonization with "pymorph" is indeed very very slow
>
> I found very nice example how to do this just with "ndimage" and in a
> blink of a second time:
>
> ========================================
> def sk(i, r):
>    x = ndimage.distance_transform_edt(i)
>    y = ndimage.morphological_laplace(x, (r, r))
>    return y < y.min()/2
> ========================================
>
> For example in pylab mode:
>
> In [1]: from scipy import ndimage
> In [2]: im = imread('clip.png')[:,:,0]
> In [3]: imshow(sk(im, 5), cmap='binary', interpolation='nearest')
> _______________________________________________
>
>
There's also a couple of skeletonize functions in scikits-image:
skeletonize<http://scikits-image.org/docs/dev/auto_examples/plot_skeleton.html>
and
medial_axis<http://scikits-image.org/docs/dev/auto_examples/plot_medial_transform.html>.
But I'm not sure how the performance compares to the other solutions you've
found.

Cheers,
-Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20120506/eb8479ba/attachment.html>


More information about the SciPy-User mailing list