Skeletonization (or the medial-axis transform) is the process of finding the "middle" axis of a region (expressed as a mask). It is performed by the
SkeletonTransform, which seems to work by thinning the mask until the "frontiers" meet, where they define the medial-axis.
There is another method, based on growing circles, which is my concern.
Consider this mask of a horse head:
Suppose you start with the small red circle that is bi-tangent to the boundary of the mask (i.e., touches the mask boundary in at least two points, as shown below).
This alternate method incrementally increases the radius of the circle and automatically adjusts the position of a new center so as to retain this bi-tangency condition.
The example image above is a hack... a kludge... based on selecting some candidate circle centers and increasing the radius until two (or more) points touch the boundary of the mask.
I would like to perform this process properly and algorithmically.
My general approach was to take the current largest circle, increment its radius by a small amount (e.g., by 1 pixel), then search for the circle center that is nearest the center of the current largest that retains bi-tangency. I think there are clever region-based primitives in Mathematica that could make efficient code, but alas I simply am not familiar enough with region-based computations. Moreover, functions such as
RegionMemberQ don't directly correspond to bi-tangency.
Ultimately, I'd like to color the circles and associated line linking centers, as kludged above.
@bills' suggestion about
RidgeFilter (new to me) really helped!
I just need to fine tune thresholds and such.