int lvmediaxis(
xvimage *image,
int wflag)
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)},
where:
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 completed 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 of keeping only the pixels that are locally maximum in the 4 neighborhod.
The MEDIAL AXIS IMAGE is a form of SKELETONIZATION.
SET OF FUNCTIONS that can be useful when using vmediaxis:
vthresh: generates a binary image
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 use vthresh on the image before using vmediaxis.
none
none
$RETRO/objects/library/vipl/src/lvmediaxis.c