Hi Jean-Patrick,

I've just had a look at the code, and it seems you've misunderstood the purpose of the `mask` keyword argument. This is not the morphological structuring element, but a binary mask overlaying the entire image and determining which pixels can and cannot be part of the skeleton. See the relevant part of the code here:

My intuition is that your calls should have resulted in some kind of ValueError (since you are indexing an array with a boolean array of a different shape), but evidently that's not true. We'll have to look into updating the docs and maybe adding some input sanitising.

As to your broader question, I don't think it's possible with the current codebase to do what you ask. We would need to update the lookup table connectivity parameter, which is currently hardcoded here:

Is there any reason why you can't just use Mahotas? =)

(Incidentally, the resolution on your characters is pretty low, which explains the wonky skeletons... Thicker characters should produce more regular skeletons, regardless of connectivity.)


On Fri, Jun 6, 2014 at 11:59 PM, Jean-Patrick Pommier <jeanpatrick.pommier@gmail.com> wrote:
The ipython notebook is here

Le jeudi 5 juin 2014 14:24:02 UTC+2, Jean-Patrick Pommier a écrit :

Is it possible to skeletonize a binary 2D shape such that  its skeleton is defined on a neighbourhood of 8 pixels?

When skeletonizing with  : morphology.medial_axis() , I tried two structuring elements (se8 or se4) as mask :

se8 = np.array([[True,True,True],[True,True,True],[True,True,True]])
se4 = np.array([[False,True,False],[True,True,True],[False,True,False]])                      
imK = makeLetterImage('K', 70)
skel = morphology.medial_axis(imK,mask=se8)
Ep_Bp, Bp_Bp, Bp, Ep = SkeletonDecomposition(skel)

The skeletons returned using se8 or se4 are very similar and look defined on a neighbourhood of 4 pixels (left). To me, this is a problem when trying to label the skeleton edges (right).


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@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.