generate_binary_structure
- scipy.ndimage.generate_binary_structure(rank, connectivity)
Generate a binary structure for binary morphological operations.
- Parameters:
- rank : int
Number of dimensions of the array to which the structuring element will be applied, as returned by np.ndim.
- connectivity : int
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 from the center are considered neighbors. may range from 1 (no diagonal elements are neighbors) to (all elements are neighbors).