scipy.ndimage.morphology.distance_transform_cdt

scipy.ndimage.morphology.distance_transform_cdt(input, metric='chessboard', return_distances=True, return_indices=False, distances=None, indices=None)

Distance transform for chamfer type of transforms.

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 rank of the array. These choices correspond to the common interpretations of the taxicab and the chessboard distance metrics in two dimensions.

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.

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

Previous topic

scipy.ndimage.morphology.distance_transform_bf

Next topic

scipy.ndimage.morphology.distance_transform_edt

This Page