core/vil/algo/vil_distance_transform.h
Go to the documentation of this file.
00001 #ifndef vil_distance_transform_h_
00002 #define vil_distance_transform_h_
00003 //:
00004 //  \file
00005 //  \brief Compute distance function
00006 //  \author Tim Cootes
00007 
00008 #include <vil/vil_image_view.h>
00009 
00010 //: Compute distance function from zeros in original image
00011 //  Image is assumed to be filled with max_dist where there
00012 //  is background, and zero at the places of interest.
00013 //  On exit, the values are the 8-connected distance to the
00014 //  nearest original zero region.
00015 // \relatesalso vil_image_view
00016 void vil_distance_transform(vil_image_view<float>& image);
00017 
00018 //: Compute directed distance function from zeros in original image
00019 //  Image is assumed to be filled with max_dist where there
00020 //  is background, and zero at the places of interest.
00021 //  On exit, the values are the 8-connected distance to the
00022 //  nearest original zero region above or to the left of current point.
00023 //  One pass of distance transform, going from low to high i,j.
00024 // \relatesalso vil_image_view
00025 void vil_distance_transform_one_way(vil_image_view<float>& image);
00026 
00027 //: Compute distance function from true elements in mask
00028 //  On exit, the values are the 8-connected distance to the
00029 //  nearest original zero region (or max_dist, if that is smaller).
00030 // \relatesalso vil_image_view
00031 void vil_distance_transform(const vil_image_view<bool>& mask,
00032                             vil_image_view<float>& distance_image,
00033                             float max_dist);
00034 
00035 //: Compute distance function from zeros in original image
00036 //  Image is assumed to be filled with max_dist where there
00037 //  is background, and zero at the places of interest.
00038 //  On exit, the values are the 24-connected distance to the
00039 //  nearest original zero region. (ie considers neighbours in
00040 //  a +/-2 pixel region around each point).
00041 //  More accurate than vil_distance_transform(image), but
00042 //  approximately twice the processing required.
00043 // \relatesalso vil_image_view
00044 void vil_distance_transform_r2(vil_image_view<float>& image);
00045 
00046 #endif