binary skeleton operation
#include "dip_binary.h"
dip_Error dip_EuclideanSkeleton ( in, out, endpixelCondition, edgeCondition )
binary
This function calculates an accurate (euclidean)skeleton. It tests Hilditch conditions to preserve topology. The algorithms uses the following distance metrics:
2D
5 | 4-connected neighbor |
7 | 8-connected neighbor |
11 | neighbors reachable with a knight's move |
3D
4 | 6-connected neighbors |
6 | 18-connected neighbors |
7 | 26-connected neighbors |
9 | neighbors reachable with knight's move |
10 | (2,1,1) neighbors |
12 | (2,2,1) neighbors |
The edge parameter specifies whether the border of the image should be treated as object (DIP_TRUE) or as background (DIP_FALSE). See section 9.6, "Morphology-based operations", in Fundamentals of Image Processing for a description of the skeleton operation.
Data type | Name | Description |
dip_Image | in | Binary input image |
dip_Image | out | Output image |
dip_EndpixelCondition | endpixelCondition | Endpixel condition |
dip_Boolean | edgeCondition | Edge condition |
The dip_EndpixelCondition enumeration consists of the following flags:
Name | Description |
DIP_ENDPIXEL_CONDITION_LOOSE_ENDS_AWAY | Loose ends are eaten away |
DIP_ENDPIXEL_CONDITION_NATURAL | "natural" endpixel condition of this algorithm |
DIP_ENDPIXEL_CONDITION_KEEP_WITH_ONE_NEIGHBOR | Keep endpoint if it has a neighbor |
DIP_ENDPIXEL_CONDITION_KEEP_WITH_TWO_NEIGHBORS | Keep endpoint if it has two neighbors |
DIP_ENDPIXEL_CONDITION_KEEP_WITH_THREE_NEIGHBORS | Keep endpoint if it has three neighbors |
EuclideanSkeleton is only implemented for 2 and 3 D images.
EuclideanSkeleton does not process pixels in a 2-pixel border around the edge. If this is an issue, consider adding 2 pixels on each side of your image.
The function is buggy for 3D images. DIP_ENDPIXEL_CONDITION_LOOSE_ENDS_AWAY and DIP_ENDPIXEL_CONDITION_KEEP_WITH_ONE_NEIGHBOR produce the same result as DIP_ENDPIXEL_CONDITION_KEEP_WITH_THREE_NEIGHBORS. Both DIP_ENDPIXEL_CONDITION_NATURAL and DIP_ENDPIXEL_CONDITION_KEEP_WITH_TWO_NEIGHBORS produce resonable results under most circumstances, but don't count on it!
"Improved metrics in image processing applied to the Hilditch skeleton", B.J.H. Verwer, 9th ICPR, Rome, November 14-17, 1988.
Ben Verwer, adapted to DIPlib by Geert van Kempen.