Module « scipy.ndimage »
Signature de la fonction distance_transform_cdt
def distance_transform_cdt(input, metric='chessboard', return_distances=True, return_indices=False, distances=None, indices=None)
Description
distance_transform_cdt.__doc__
Distance transform for chamfer type of transforms.
In addition to the distance transform, the feature transform can
be calculated. In this case the index of the closest background
element to each foreground element is returned in a separate array.
Parameters
----------
input : array_like
Input
metric : {'chessboard', 'taxicab'} or array_like, 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.
A custom metric may be provided, in the form of a matrix where
each dimension has a length of three.
'cityblock' and 'manhattan' are also valid, and map to 'taxicab'.
The default is 'chessboard'.
return_distances : bool, optional
Whether to calculate the distance transform.
Default is True.
return_indices : bool, optional
Whether to calculate the feature transform.
Default is False.
distances : int32 ndarray, optional
An output array to store the calculated distance transform, instead of
returning it.
`return_distances` must be True.
It must be the same shape as `input`.
indices : int32 ndarray, optional
An output array to store the calculated feature transform, instead of
returning it.
`return_indicies` must be True.
Its shape must be `(input.ndim,) + input.shape`.
Returns
-------
distances : int32 ndarray, optional
The calculated distance transform. Returned only when
`return_distances` is True, and `distances` is not supplied.
It will have the same shape as the input array.
indices : int32 ndarray, optional
The calculated feature transform. It has an input-shaped array for each
dimension of the input. See distance_transform_edt documentation for an
example.
Returned only when `return_indices` is True, and `indices` is not
supplied.
Améliorations / Corrections
Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Emplacement :
Description des améliorations :