[Numpy-discussion] binary thinning

Peter Verveer verveer at embl-heidelberg.de
Thu Dec 16 10:43:03 CST 2004


Hi Bob,

Thanks for using the nd_image code. It is helpful to get some user 
feedback. I think I did not tell you in  my last email, but your last 
questions actually allowed me to find a few minor bugs and fix them...

> First, to answer your question about changing the order in which 
> structures are applied. It turns out it does matter. I tried rotating 
> the structures clockwise and counter-clockwise, pre-rotating the 
> structure before doing the four rotations, and I permutating the 
> order, and in some of those cases the results are different, although 
> usually only slightly different - a couple pixels here, a few there.

This seems reasonable to me, I would expect that the order matters.

> Second, no matter what I tried, I could not duplicate the picture in 
> the webpage.
>
> Third, besides the test image (off the webpage) I also tested a 
> skeleton function on few other images using several packages available 
> to me, including an old Matrox MIL, ImageJ, and Matlab. Each one of 
> them produced different results. I'm not sure that one is more correct 
> than another, they're probably all correct. In general the nd_image 
> skeleton produces results similar to Matlab.

It seems then that there is no accepted single solution for the 
skeleton, so I guess the code from nd_image is okay then.

> Peter, would you be interested in adding a few binary morphology 
> functions to nd_image? So far I have working versions of borderkill, 
> borderkeep, reconstruct, thinning, thickening, skeleton, skiz, and 
> convex hull. Even though they were all produced with just what's there 
> right now (erosion, dilation, and hit-or-miss) and a few numarray 
> functions, it took a long time to figure out and could be helpful to 
> the next guy. I'd be happy to send you what I got and/or post it.

One issue is that nd_image functions are supposed to be generic and 
work in any dimension. So I kept the binary morphology low-level on 
purpose, so far. But on the other hand, I don't see why we could not 
add some stuff even if it only works in 2D (which I assume is the case 
with your code.) Why don't you send me what you have and I have a look 
in the next weeks?

Cheers, Peter





More information about the Numpy-discussion mailing list