lvdistance(3)

LIBRARY ROUTINE
lvdistance - Computes the distance from the boundary in a two_valued byte image.

LIBRARY CALL
#include "vinclude.h"
int
lvdistance(image)
struct xvimage *image;

INPUT

    image _ structure xvimage.

OUTPUT

    image _ holds the result.

MODIFICATIONS

DESCRIPTION
lvdistance Computes the distance from the nearest boundary point.

The distance transform respects the following iterative algorithm :

U(m,n) : original image. This image contains only two gray levels, 0 for the background, and any value but 0 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)=U0(m,n)+min{Uk-1(i,j);((i,j):dist(m,n;i,j)<= 1)},

    dist(m,n;i,j) is the distance 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 distance image can be used to extract edges or themedial axis (form of skeleton).

Set of functions that can be used with vdistance:

vmedian
    Customizes the medial axis from the distance image.

vthresh
    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.
It is advisable to use vthresh prior to using vdistance.

SEE ALSO
vdistance(1), intro(3), vipl(3), verror(3), vutils(3) lvthresh(3), vthresh(1).

RESTRICTIONS
lvdistance works only on BYTE binary images which background value is zero.

AUTHOR
Pascal ADAM

COPYRIGHT
Copyright 1991, University of New Mexico. All rights reserved.