The THIN function returns the "skeleton" of a bi-level image. The skeleton of an object in an image is a set of lines that reflect the shape of the object. The set of skeletal pixels can be considered to be the medial axis of the object. For a much more extensive discussion of skeletons and thinning algorithms, see Algorithms for Graphics and Image Processing , Theo Pavlidis, Computer Science Press, 1982. The THIN function is adapted from Algorithm 9.1 (the classical thinning algorithm).

On input, the bi-level image is a rectangular array in which pixels that compose the object have a nonzero value. All other pixels are zero. The result is a byte type image in which skeletal pixels are set to 2 and all other pixels are zero.

Calling Sequence

Result = THIN( Image )



The two-dimensional image (array) to be thinned.


The following commands display the "thinned" edges of a Sobel filtered image:

OPENR, 1, FILEPATH('people.dat', SUBDIR = ['examples','data'])
; Open a file for reading.

A = BYTARR(192, 192) ; Create a byte array in which to store the image.

READU, 1, A ; Read first 192 by 192 image.

CLOSE, 1 ; Close the file.

TV, A, 0 ; Display the image.

TVSCL, THIN(SOBEL(A) GT 75), 1 ; Apply the Sobel filter, threshold the image at value 75, and display the thinned edges.

See Also