def intertial_axis(data):

    data_sum = data.sum()
    m10 = raw_moment(data, 1, 0)
    m01 = raw_moment(data, 0, 1)
    x_bar = m10 / data_sum
    y_bar = m01 / data_sum
    u11 = (raw_moment(data, 1, 1) - x_bar * m01) / data_sum
    u20 = (raw_moment(data, 2, 0) - x_bar * m10) / data_sum
    u02 = (raw_moment(data, 0, 2) - y_bar * m01) / data_sum
    cov = numpy.array([[u20, u11], [u11, u02]])

    return x_bar, y_bar, cov
Calculate the x-mean, y-mean, and cov matrix of an image.
dataset/ETHPy150Open basilfx/Course-Face3D/face3d/utils.py/intertial_axis