SIP Toolbox

skel - skeletonization, thinning, Medial Axis Transform

Calling Sequence

[skl,dt,lbl] = skel(img [,side, algorithm])

Input Parameters

Output Parameters

Description

Function skel performs skeletonization (thinning) of a binary object. The resulting medial axis is multi-scale, meaning that it can be progressively pruned to eliminate detail. This pruning is done by thresholding the output skeleton image.

The algorithm computes skeletons that are guaranteed to be connected over all scales of simplification. The skeletons are computed using the euclidean metric. This has the advantage to produce high-quality, isotropic and well-centered skeletons in the shape. However the exact algorithm is computationally intensive.

The radius of the maximal balls associated with the skeleton points are stored in the distance transform output image.

Examples

    initial_dir = PWD;
    chdir (SIPDIR + 'images');
    xset('auto clear', 'on');

    im=gray_imread('escher.png');
    imshow(im,2);
    [skl,dt,vor] = skel(im);

    // Fine detail
    sklt = (skl >= 5);
    imshow(im+sklt,[]);

    // Less detail
    sklt = (skl >= 20);
    imshow(im+sklt,[]);

    // The Distance Transform
    imshow(sqrt(dt),[]);

    // The Influence/Voronoi diagram of each boundary pixel
    imshow(vor+1,rand(maxi(vor)+1,3));   // each region maps to a random color

    // Let's see if computation is really fast
    big = mogrify(im,['-sample','1000x']);
    size(big)
    skl = skel(big);
    imshow(big + (skl >= 50),[]);


    xset('auto clear', 'off');
    chdir(initial_dir);

Bibliography

For the fast euclidean algorithm: "Multiscale Skeletons by Image Foresting Transform and its Application to Neuromorphometry", A.X. Falcao, L. da F. Costa, B.S. da Cunha, Pattern Recognition, 2002.

For the exact euclidean algorithm:

"Multiresolution shape representation without border shifting", L. da F. Costa, L. F. Estrozi, Electronics Letters, no. 21, vol. 35, pp. 1829-1830, 1999.

"Shape Analysis and Classification", L. da F. Costa and R.M. Cesar Jr., CRC Press.

Known Bugs

This function may not work for some kinds of input that is already thin in some parts; it is a good idea to apply morphological dilation and closing before applying skel.

Authors

Ricardo Fabbri <ricardofabbri (AT) users DOT sf DOT net>

Availability

The latest version of the Scilab Image Processing toolbox can be found at

http://siptoolbox.sourceforge.net

See Also

thin,  reconstruction (not done yet...),