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

Multi-dimensional binary closing 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 dilations and then the erosions are done.