SKELETONIZE Function (PV-WAVE Extreme Advantage)
Performs the morphologic skeletonizing operation for shape processing.
Usage
result = SKELETONIZE(image, structure[, x0, y0])
Input Parameters
image—The array to be skeletonized.
structure—A 1D or 2D array containing the structuring elements. The structure elements are interpreted as binary elements with values of either zero or nonzero, unless the Gray keyword is used.
x0—(optional) The x-coordinate of the structure’s origin.
y0—(optional) The y-coordinate of the structure’s origin.
Returned Value
result—A skeletonized image of the same size and dimensions as image.
Keywords
Gray—If set, indicates that gray-scale erosion and dilation is to be used. (Default: binary erosion and dilation)
Max_Iter—Specifies the maximum number of iterations to perform in the skeletonization process. (Default: 100)
Values—An array of values of the structuring element. The Values array must have the same dimensions and number of elements as the structure parameter.
Discussion
Morphological operations are defined for grayscale byte images. If image is not originally of type byte, PV‑WAVE makes a temporary copy of image that is of type byte before using it for the morphological processing.
The optional parameters x0 and y0 specify the row and column coordinates of the structuring element’s origin. If these parameters aren’t used, the structuring element origin is set to the center, (Nx/2, Ny/2), where Nx and Ny are the dimensions of the structuring element.
The skeletonization of an object describes its structure. Skeletonization is also referred to as the medial axis transform. The result of a call to SKELETONIZE is an image consisting of the set of points that are equidistant from the boundary of an object. These points are the “medial axis” of the object.
The skeletonization process is performed using loops in which image is logically ORed with the difference of the erosion and morphological opening operations. The looping process ends when either the maximum iteration is reached, or the next pass through the loop would result in a completely eroded (null) image. In other words, skeletonization is the union of the difference between the i-th eroded image and the opening of the i-th eroded image. Where i is the minimum of Max_Iter or the iteration which produces the null image. The image returned by the skeletonization process is then the union of all i difference images.
Example
; Threshold the objects to form a binary image.
blobs = IMAGE_READ(!IP_Data + 'blobs.tif')
blobs = THRESHOLD(blobs('pixels'), 20, /Binary)
; Create a structuring element.
str_ele = BYTARR(3, 3)
str_ele(*) = 1B
str_ele(1, 1) = 0B
str_ele(0, 0) = 0B
str_ele(0, 2) = 0B
str_ele(2, 0) = 0B
str_ele(2, 2) = 0B
; Skeletonize the objects using the circular structuring element.
skel_image = SKELETONIZE(blobs, str_ele)
TVSCL, skel_image
See Also
In the PV‑WAVE Reference: ERODE, DILATE