The ipython notebook is here

Le jeudi 5 juin 2014 14:24:02 UTC+2, Jean-Patrick Pommier a écrit :
Hi,
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).

Jean-Patrick