scipy.ndimage.distance_transform_cdt¶

scipy.ndimage.
distance_transform_cdt
(input, metric='chessboard', return_distances=True, return_indices=False, distances=None, indices=None)[source]¶ Distance transform for chamfer type of transforms.
Parameters: input : array_like
Input
metric : {‘chessboard’, ‘taxicab’}, optional
The metric determines the type of chamfering that is done. If the metric is equal to ‘taxicab’ a structure is generated using generate_binary_structure with a squared distance equal to 1. If the metric is equal to ‘chessboard’, a metric is generated using generate_binary_structure with a squared distance equal to the dimensionality of the array. These choices correspond to the common interpretations of the ‘taxicab’ and the ‘chessboard’ distance metrics in two dimensions.
The default for metric is ‘chessboard’.
return_distances, return_indices : bool, optional
The return_distances, and return_indices flags can be used to indicate if the distance transform, the feature transform, or both must be returned.
If the feature transform is returned (
return_indices=True
), the index of the closest background element is returned along the first axis of the result.The return_distances default is True, and the return_indices default is False.
distances, indices : ndarrays of int32, optional
The distances and indices arguments can be used to give optional output arrays that must be the same shape as input.