Calculate mean and covariance from images