.. _example_plot_skeleton.py:


===========
Skeletonize
===========

Skeletonization reduces binary objects to 1 pixel wide representations. This
can be useful for feature extraction, and/or representing an object's topology.

The algorithm works by making successive passes of the image. On each pass,
border pixels are identified and removed on the condition that they do not
break the connectivity of the corresponding object.

This module provides an example of calling the routine and displaying the
results. The input is a 2D ndarray, with either boolean or integer elements.
In the case of boolean, 'True' indicates foreground, and for integer arrays,
the foreground is 1's.

.. image:: images/plot_skeleton_1.png
    :align: center


.. literalinclude:: plot_skeleton.py
    :lines: 18-



**Python source code:** :download:`download <plot_skeleton.py>`
(generated using ``skimage`` |version|)



**IPython Notebook:** :download:`download <./notebook/plot_skeleton.ipynb>`
(generated using ``skimage`` |version|)

