[Numpy-discussion] binary thinning

Bob Klimek klimek at grc.nasa.gov
Thu Dec 16 10:07:02 CST 2004


Peter Verveer wrote:

> Hi Bob,
>
> Below I give my implementation, which does not produce the exact same 
> result as shown on the webpage you refer to, although the result seems 
> to be a proper skeleton. This may be because the order in which the 
> structures are applied matters (I think). Could you maybe test that by 
> permutating the order in which the structures are applied? I would be 
> interested if this is true and if one can get the same result as on 
> the webpage by finding the right sequence...

Peter,

I'm finally able to get back with some answers; unfortunately, for a 
number of reasons my time spent on this is quite fragmented.

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.

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.

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.

Regards,
Bob










More information about the Numpy-discussion mailing list