在二维点云中寻找空洞

Finding holes in 2d point cloud

我有一组二维点。它们是标准笛卡尔网格系统上的 X、Y 坐标。有谁知道一种方法来实现(优先在 Python 中)一种算法,该算法将隔离每个 "hole's area" 以便找到每个孔的最大直径。

下面是实际点集的示例:

更新:

我设法用固定数量的簇隔离了每个区域,但是如何根据 "hole's area" 的数量来定义簇的数量?

from sklearn.cluster import KMeans
import numpy as np
import  ipyvolume.pylab as p

dat     = xyz
xycoors = dat[:,0:2]


fit = KMeans(n_clusters=5).fit(xycoors)
clus_datas={i: xycoors[np.where(fit.labels_ == i)] for i in 
range(fit.n_clusters)}

clus_1=clus_datas[0]
clus_2=clus_datas[1]
clus_3=clus_datas[2]
clus_4=clus_datas[3]
clus_5=clus_datas[4]



min_bloc=np.array(nuage)
fig = p.figure(width=1000)
fig.xlabel='x'
fig.ylabel='z'
fig.zlabel='y'

p.scatter(clus_1[:,1], clus_1[:,1]*0, clus_1[:,0], color="black", size=.1)     
p.scatter(clus_2[:,1], clus_2[:,1]*0, clus_2[:,0], color="red",  size=.1) 
p.scatter(clus_3[:,1], clus_3[:,1]*0, clus_3[:,0], color="green",  size=.1) 
p.scatter(clus_4[:,1], clus_1[:,1]*0, clus_4[:,0], color="bleu",  size=.1)     
p.scatter(clus_5[:,1], clus_2[:,1]*0, clus_5[:,0], color="red", size=.1) 

p.squarelim()
p.show()

结果:

已解决 Density-based spatial clustering of applications with noise (DBSCAN) Identify each hole according to estimated number of clusters, the diameter can be calculated using the Convex hull