pff's homepage
Distance Transforms of Sampled Functions
Below is a C++ implementation of the distance transform algorithm described in the paper:
Distance Transforms of Sampled Functions
P. Felzenszwalb, D. Huttenlocher
Theory of Computing, Vol. 8, No. 19, September 2012
PDF
Code Download
Example Result