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

Luis Pedro Coelho lpc@cmu....
Mon Apr 2 11:25:44 CDT 2012


On Saturday, March 31, 2012 08:08:41 PM klo uo wrote:
>  I tried grey opening on sample image with both modules. Approach seems
> good and result is bit identical with both modules (footprint=square(3)),
> and I thought to comment on differences on both modules:
> 
>  - skimage requires converting data type to 'uint8' and won't accept
> anything less
>  - ndimage grey opening is 3 times faster on my PC

Mahotas (which I wrote): http://luispedro.org/software/mahotas is closer in 
implementation to ndimage and should be as fast (as well as supporting 
multiple types).

It doesn't have the open() operation, but you can dilate() & erode() yourself:

def open(f, Bc, output=None):
       output = mahotas.dilate(f, Bc, output=output)
       return mahotas.erode(f, Bc, output=output)

(Also, I think that the skimage erode() & dilate() are for flat structuring 
elements only, but that doesn't seem to be an issue for you).

HTH,
-- 
Luis Pedro Coelho | Institute for Molecular Medicine | http://luispedro.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://mail.scipy.org/pipermail/scipy-user/attachments/20120402/64f47eca/attachment.bin 


More information about the SciPy-User mailing list