scipy.ndimage.morphology.distance_transform_edt(input, sampling=None, return_distances=True, return_indices=False, distances=None, indices=None)

Exact euclidean distance transform.

In addition to the distance transform, the feature transform can be calculated. In this case the index of the closest background element is returned along the first axis of the result.

The return_distances, and return_indices flags can be used to indicate if the distance transform, the feature transform, or both must be returned.

Optionally the sampling along each axis can be given by the sampling parameter which should be a sequence of length equal to the input rank, or a single number in which the sampling is assumed to be equal along all axes.

the distances and indices arguments can be used to give optional output arrays that must be of the correct size and type (float64 and int32).