cupyx.scipy.ndimage.generate_binary_structure(rank, connectivity)

Generate a binary structure for binary morphological operations.

  • rank (int) – Number of dimensions of the array to which the structuring element will be applied, as returned by np.ndim.

  • connectivity (int) – connectivity determines which elements of the output array belong to the structure, i.e., are considered as neighbors of the central element. Elements up to a squared distance of connectivity from the center are considered neighbors. connectivity may range from 1 (no diagonal elements are neighbors) to rank (all elements are neighbors).


Structuring element which may be used for binary

morphological operations, with rank dimensions and all dimensions equal to 3.

Return type