The median axis of a region in a binary image is the set of pixels whose minimum distance from the edge is a local maximum. It is a thinning algorithm that is comparable to the morphological skeletonization. The median axis is generally not connected.
An optional flag allows the user to obtain the medial axis pixel values set
either to their distance from the border, or to 255. If the flag is set to
one, it leads to a better visualization of the median axis but
the information that permits the user to reconstruct the original binary
image is lost.
If the flag is not set to 1, it is possible to reconstruct the original
image from the medial axis.
Presentation of the medial axis transform algorithm :
U(m,n) : original image.
This image must be a two-valued byte image, 0 for the background, and
any other value for the objects.
Uk(i,j) : image after k iterations.
U0(m,n)= U(m,n) , and for k= 1, 2, 3, ...
Uk(m,n)= U(m,n)+min{U0(i,j);((i,j):dist(m,n;i,j)<= 1)},
dist(m,n;i,j) is the mediaxis between (m,n) and (i,j).
dist(i,j-1;i,j)=dist(i,j+1;i,j)=dist(i-1,j;i,j)=dist(i+1,j;i,j)=1.
dist(i-1,j-1;i,j)=dist(i+1,j-1;i,j)=dist(i-1,j+1;i,j)=dist(i+1,j+1;i,j)=2.
The transform is done when k equals the maximum thickness of the region, that is when Uk+1 equals Uk.
The last part consists of using this image and keeping only the
pixels that are a local maximum in the 4 neighborhood.
The Medial Axis image is a form of skeletonization.
.B Functions that can be useful when using vmediaxis:
\fBthreshold generates a binary image.
ADVICE:
For this routine, the image must be a byte binary image, with the gray level value 0 for the background. So it is advisable to threshold the image before using vmediaxis.
vmediaxis -i image1 [-w wflag] -o image2
Computes the medial axis transform.
For this routine, the image must be a byte binary image, with the gray-level value 0 for the background. So it is advisable to threshold the image before using vmediaxis.