3D Voronoi 图:"Radius inconsistent with generators"

3D Voronoi diagram: "Radius inconsistent with generators"

我想计算通过立体视觉获得的 3d 点云的 "density"。

我像 https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.SphericalVoronoi.html

中那样实现了 3D Voronoi 图

许多不同幅度的结果是 ValueError("Radius inconsistent with generators.")(我尝试了很多)

我的点云示例是:

[[ 0.63492548  0.10921954  0.12711886]
 [ 0.14530358  0.02687934 -0.0357723 ]
 [ 0.16594444  0.02741969  0.04187516]
 [ 0.69606036  0.06983382 -0.04752853]
 [ 0.31324029 -0.10254659 -0.06861327]
 [ 0.14450935 -0.07421818 -0.07544217]
 [ 0.66847998  0.08925844  0.2252084 ]
 [ 0.17888862  0.02983894  0.01823071]
 [ 0.65812635  0.1793924  -0.00177464]
 [ 0.7880221   0.25733843 -0.22293468]]

a) 我该如何解决这个问题?

b) 我的点云也在根据我所在的位置而变化(点云是真实世界的坐标)。 所以我认为我需要一个自适应度量来根据点云本身输入半径?

和想法? 非常感谢!:)

def voronoi_volumes(points):
    v = Voronoi(points)
    vol = np.zeros(v.npoints)
    for i, reg_num in enumerate(v.point_region):
        indices = v.regions[reg_num]
        if -1 in indices: # some regions can be opened
            vol[i] = np.inf
        else:
            try:
                vol[i] = ConvexHull(v.vertices[indices]).volume
            except:
                vol[i] = np.inf
    return vol