scipy.ndimage.morphology.generate_binary_structure

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

Generate a binary structure for binary morphological operations.

The inputs are the rank of the array to which the structure will be applied and the square of the connectivity of the structure.