skimage 0.17.2

NotesParametersReturnsBackRef
thin(image, max_iter=None)

Notes

This algorithm works by making multiple passes over the image, removing pixels matching a set of criteria designed to thin connected regions while preserving eight-connected components and 2 x 2 squares . In each of the two sub-iterations the algorithm correlates the intermediate skeleton image with a neighborhood mask, then looks up each neighborhood in a lookup table indicating whether the central pixel should be deleted in that sub-iteration.

Parameters

image : binary (M, N) ndarray

The image to be thinned.

max_iter : int, number of iterations, optional

Regardless of the value of this parameter, the thinned image is returned immediately if an iteration produces no change. If this parameter is specified it thus sets an upper bound on the number of iterations performed.

Returns

out : ndarray of bool

Thinned image.

Perform morphological thinning of a binary image.

See Also

medial_axis
skeletonize

Examples

This example is valid syntax, but we were not able to check execution
>>> square = np.zeros((7, 7), dtype=np.uint8)
... square[1:-1, 2:-2] = 1
... square[0, 1] = 1
... square array([[0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
This example is valid syntax, but we were not able to check execution
>>> skel = thin(square)
... skel.astype(np.uint8) array([[0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]], dtype=uint8)
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

skimage.morphology._skeletonize.thin

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /skimage/morphology/_skeletonize.py#259
type: <class 'function'>
Commit: