scipy.ndimage.measurements.center_of_mass

scipy.ndimage.measurements.center_of_mass(input, labels=None, index=None)

Calculate the center of mass of of the array.

The index parameter is a single label number or a sequence of label numbers of the objects to be measured. If index is None, all values are used where labels is larger than zero.