scipy.ndimage.morphology.binary_opening(input, structure=None, iterations=1, output=None, origin=0)

Multi-dimensional binary opening with the given structure.

An output array can optionally be provided. The origin parameter controls the placement of the filter. If no structuring element is provided an element is generated with a squared connectivity equal to one. The iterations parameter gives the number of times the erosions and then the dilations are done.