# NAME

chamfer_transform - Computes the chamfer distance transform of a binary edge image.
# SYNOPSIS

#include "g/g_chamfer.h"
Example compile flags (system dependent):
-DLINUX_X86_64 -DLINUX_X86_64_OPTERON -DGNU_COMPILER
-I/home/kobus/include
-L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
-lKJB -lfftw3 -lgsl -lgslcblas -ljpeg -lSVM -lstdc++ -lpthread -lSLATEC -lg2c -lacml -lacml_mv -lblas -lg2c -lncursesw
int chamfer_transform
(
const Matrix *in,
int size,
Matrix **distances_out,
Int_matrix_vector **locations_out
);

# DESCRIPTION

Input is a binary edge image represented as a Matrix, and output is a map of
the distance and location of the nearest edge point in the input image.
The local maxima of the distance map is the voronoi diagram of the edge
points. The size parameter sets the neighborhood size when propagating
distance values; higher value will result in lower approximation error but
increases running time. Valid values for size are 3, 5, or 7.
After returning, distances_out will hold the distance map, and locations_out
will hold two matrices representing the x and y locations of the nearest edge
point, respectively.
# RETURNS

NO_ERROR on success, and ERROR on failure, with an error message being
set.
# WARNING

As the exact distance transform is expensive to compute, the chamfer distance
transform is a fast approximation. When the voronoi diagram has corners with
very acute angles, the chamfer transform may report the nearest edge point
incorrectly. Also, distances are not computed directly but instead are
propogated from neighboring pixels and are subject to approximation error.
Using higher size values diminshes this effect somewhat. These errors are
generally of little concern, but do be aware of them.
# RELATED

image_to_matrix
# DISCLAIMER

This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.
# AUTHOR

Kyle Simek
# DOCUMENTER

Kobus Barnard
# SEE ALSO

chamfer_transform_2
,
sum_sq_distance
,
chamfer_distance
,
oriented_sum_sq_distance
,
oriented_chamfer_distance