计算一个个点的周围N个点拟合的平面,然后计算该点到这个平面的距离,作为该点的粗糙度;
每个点的粗糙度平均值就是这个点云的整体粗糙度
from numpy.linalg import norm
from numpy.linalg import svd
Given an array, points, of shape (d,...)
representing points in d-dimensional space,
fit an d-dimensional plane to the points.
Return a point, p, on the plane (the point-cloud centroid),
points = np.transpose(points)
points = np.reshape(points, (np.shape(points)[0], -1))
assert points.shape[0] <= points.shape[1], "There are only {} points in {} dimensions.".format(points.shape[1], points.shape[0])
ctr = points.mean(axis=1)
x = points - ctr[:, np.newaxis]