您好,请问这张图上的点云可以进行Delaunay三角化吗?
def boundary_extract(points, err=10e-3):
pts = np.copy(points)
tree = KDTree(pts, leaf_size=2)
# adapt_R = adaptive_alpha(tree, 21)
tri = Delaunay(pts) #在这一步报错
s = tri.simplices
N = s.shape[0]
i = 0
edges = []
centers = []
while i <= N - 1:
if s[i, 0] == -1:
i = i + 1
continue
p3 = s[i]
e1 = np.array([points[p3[0], :], points[p3[1], :]])
e2 = np.array([points[p3[1], :], points[p3[2], :]])
e3 = np.array([points[p3[0], :], points[p3[2], :]])
e = [e1, e2, e3]
for j in range(3):
flag, center = edge_check_valid(e[j], tree, adapt_R[i], err)
if flag:
edges.append(e[j])
centers.append(center)
nb = tri.neighbors[i]
nb_valid = nb[nb != -1]
# nb_valid_num = nb_valid.shape[0]
# s[nb_valid] = -1
i = i + 1
return edges, centers
Traceback (most recent call last):
File "D:/pythonProjectForOpen3D/src/basic/area/AlphaShape.py", line 149, in <module>
edges, centers = boundary_extract(final_pointCloud_array, err=10e-5)
File "D:/pythonProjectForOpen3D/src/basic/area/AlphaShape.py", line 66, in boundary_extract
tri = Delaunay(pts)
File "qhull.pyx", line 1840, in scipy.spatial.qhull.Delaunay.__init__
File "qhull.pyx", line 356, in scipy.spatial.qhull._Qhull.__init__
scipy.spatial.qhull.QhullError: QH6154 Qhull precision error: Initial simplex is flat (facet 1 is coplanar with the interior point)
While executing: | qhull d Qz Qt Qc Qbb Q12
Options selected for Qhull 2019.1.r 2019/06/21:
run-id 1401204984 delaunay Qz-infinity-point Qtriangulate Qcoplanar-keep
Qbbound-last Q12-allow-wide _pre-merge _zero-centrum Qinterior-keep
Pgood _max-width 40 Error-roundoff 4e-14 _one-merge 3.6e-13
Visible-distance 2.4e-13 U-max-coplanar 2.4e-13 Width-outside 4.8e-13
_wide-facet 1.4e-12 _maxoutside 4.8e-13
precision problems (corrected unless 'Q0' or an error)
142 zero divisors during gaussian elimination
The input to qhull appears to be less than 4 dimensional, or a
computation has overflowed.
Qhull could not construct a clearly convex simplex from points:
- p0(v5): 19 4.5 0 2.2
- p36(v4): 0.095 20 0 3
- p110(v3): -0.033 -20 0 3.1
- p140(v2): 20 -0.14 0 3
- p78(v1): -20 0.77 0 1.7
The center point is coplanar with a facet, or a vertex is coplanar
with a neighboring facet. The maximum round off error for
computing distances is 4e-14. The center point, facets and distances
to the center point are as follows:
center point 3.912 1.025 0 2.595
facet p36 p110 p140 p78 distance= 0
facet p0 p110 p140 p78 distance= 0
facet p0 p36 p140 p78 distance= 0
facet p0 p36 p110 p78 distance= 0
facet p0 p36 p110 p140 distance= 0
These points either have a maximum or minimum x-coordinate, or
they maximize the determinant for k coordinates. Trial points
are first selected from points that maximize a coordinate.
The min and max coordinates for each dimension are:
0: -19.87 19.97 difference= 39.84
1: -19.97 19.97 difference= 39.94
2: 0 0 difference= 0
3: 0 19.97 difference= 19.97
If the input should be full dimensional, you have several options that
may determine an initial simplex:
- use 'QJ' to joggle the input and make it full dimensional
- use 'QbB' to scale the points to the unit cube
- use 'QR0' to randomly rotate the input for different maximum points
- use 'Qs' to search all points for the initial simplex
- use 'En' to specify a maximum roundoff error less than 4e-14.
- trace execution with 'T3' to see the determinant for each point.
If the input is lower dimensional:
- use 'QJ' to joggle the input and make it full dimensional
- use 'Qbk:0Bk:0' to delete coordinate k from the input. You should
pick the coordinate with the least range. The hull will have the
correct topology.
- determine the flat containing the points, rotate the points
into a coordinate plane, and delete the other coordinates.
- add one or more points to make the input full dimensional.
Process finished with exit code 1
目前还没找到解决办法
希望可以找到报错的原因并解决问题