A fast algorithm for Euclidean distance maps of a 2-D binary image - Chen, Ling; Chuang, Henry Y.H. (Information processing letters, 1994)
The Euclidean distance map (EDM) is a basic operation in computer vision, pattern recognition, and robotics. It converts a binary image consisting of foreground pixels and background pixels into one where each pixel has a value equal to its Euclidean distance to the nearest foreground pixel. Yamada (1984) presented an O(n-cubed) EDM algorithm that can be computed in O(n) time on an 8-neighbor connected mesh array of size n x n. Kolountzakis and Kutulakos (1992) presented an O(n-squared log n) sequential algorithm for EDM. They also showed that, on an r-process, with r less than or equal to n, exclusive read excluxive write parallel random access machine (EREW PRAM), the time complexity of the algorithm is O((n-squared log n)/r). An analysis presents a parallel algorithm on the r-processor EREW PRAM with time complexity O(n-squared/r + n log r). Particularly, when r equals one, it is a sequential algorithm with time complexity O(n-squared). The time complexity is optimal because in any EDM algorithm each of the n-squared pixels has to be scanned at least once.