distance_transform_bf(input, metric='euclidean', sampling=None, return_distances=True, return_indices=False, distances=None, indices=None)
This function calculates the distance transform of the input, by replacing each foreground (non-zero) element, with its shortest distance to the background (any zero-valued element).
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.
This function employs a slow brute force algorithm, see also the function distance_transform_cdt for more efficient taxicab and chessboard algorithms.
Input
'cityblock' and 'manhattan' are also valid, and map to 'taxicab'. The default is 'euclidean'.
This parameter is only used when metric is 'euclidean'. Spacing of elements along each dimension. If a sequence, must be of length equal to the input rank; if a single number, this is used for all axes. If not specified, a grid spacing of unity is implied.
Whether to calculate the distance transform. Default is True.
Whether to calculate the feature transform. Default is False.
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, and of type float64 if metric is 'euclidean', uint32 otherwise.
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.
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.
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.
Distance transform function by a brute force algorithm.
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them