cupyx.scipy.ndimage.label(input, structure=None, output=None)

Labels features in an array.

  • input (cupy.ndarray) – The input array.

  • structure (array_like or None) – A structuring element that defines feature connections. `structure` must be centersymmetric. If None, structure is automatically generated with a squared connectivity equal to one.

  • output (cupy.ndarray, dtype or None) – The array in which to place the output.


An integer array where each unique feature in `input` has a unique label in the array.

num_features (int): Number of features found.

Return type

label (cupy.ndarray)


This function may synchronize the device.