Hi Juan,

You're right, I thought that the mask was a structuring element.

Regarding the way a skeleton is computed (C4 with skimage or C8 with mahotas), there's different advantages/difficulties. With a C4 skeleton, the branched points of the skeleton seems to be a unique pixel. The difficulties come when the edges (skeleton-branched points) are being  labelled (on a neighbourhood of 4 or 8 pixels). If the edges derive from a c8 skeleton (mahotas.thin), labelling the edges with a neighbourhood of 4 pixel is easy. However, the use of a C8 skeleton leads to branched "domain" which can be more than one pixel.

I was wondering if it was possible to have a C8 skeleton with branched domain of only one pixel. This difficulty with C8 skeletons may be bypassed now. The aim would be to convert a skeleton into a graph : some results are visible in an ipython notebook, up to now the code works for some cases (some explanations) ...By the way is there a "regular" way way to solve that problem?

Best regards

Jean-Patrick

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