This page contains free (GNU GPL v3+) source code for Matlab implementations of our anti-aliased Euclidean distance transform, as presented in Pattern Recognition Letters January 2011.

There is an errata sheet that fixes some unfortunate typos in equations (2) and (3).

The archive below contains C and C++ files in MEX format for Matlab or Octave. They should work on all platforms supported by either Matlab and Octave. To use the functions, unpack the files in the working directory and type e.g. "mex edtaa.c". The Matlab wrapper for the "edtaa" MEX function is "edtaa.c", and the reusable generic C function is in "edtaafunc.c". Several implementations are provided, with different accuracy and speed as presented in the article:

- "edt.c" and "edtfunc.c" is the reference binary EDT.
- "edtaa.c" and "edtaafunc.c" is the simple linear approximation AA-EDT.
- "edtaa2.c" and "edtaa2func.c" is the more accurate angle dependent AA-EDT.
- "edtaa3.c" and "edtaa3func.c" is the improved version with gradient-estimated edge directions near edges.
- "edtaa4.c" and "edtaa4func.c" is the further improved version with post-processing fine adjustment of the distances near edges.
- "FMM.cpp" is an implementation of the approximate but popular Fast Marching Method with AA. This is not described in the article, and the source code is provided here without any extra documentation.

An archive with all these files can be downloaded by the following link:

http://www.itn.liu.se/~stegu/edtaa/edtaa.zip

*Stefan Gustavson (stegu@itn.liu.se), Robin Strand (robin@cb.uu.se), 2010-09-23*