Image.thin#

Image.thin(**kwargs: Any) Self[source]#

Morphological skeletonization

Parameters:

kwargs – options passed to hitormiss

Returns:

Image

Return type:

Image instance

Return the thinned version (skeleton) of the binary image as another binary image. Any non-zero region is replaced by a network of single-pixel wide lines.

Example:

>>> from machinevisiontoolbox import Image
>>> img = Image.String('000000|011110|011110|000000')
>>> img.print()
   0 0 0 0 0 0
   0 1 1 1 1 0
   0 1 1 1 1 0
   0 0 0 0 0 0
>>> img.thin().print()
   0 0 0 0 0 0
   0 1 0 0 1 0
   0 0 1 1 0 0
   0 0 0 0 0 0
>>> img = Image.Read("shark2.png")
>>> skeleton = img.thin()
References:
Seealso:

thin_animate hitormiss endpoint triplepoint