三维点云学习(7)5-Feature 实现ISS
参考博客
数据集下载
效果图:
eg.文末有其他物体的效果图展示
airplane_0001
红色圆圈为 提取的特征点
可以看出特征点大致呈对称分布或分布于物体中轴线上:
主要coding思路:
特征点(关键点)
step1 使用radius NN 得到n个初始关键点, 确定 threshold 阈值
step2 随机选取一个关键点,寻找这个关键点的nearest 中的其他关键点,构成一个关键点群。 思路类似(DBSCAN)
step3 NMS 非极大抑制,比较 在一个关键点群中,每个关键点的 linda3,最大的linda3对应的点即定为这个关键点群的关键点
step4 iearation step2-step3
代码部分模块
构建点云坐标的协方差矩阵、求解cov特征值,并把特征值降序输出
def compute_cov_eigval(point_cloud):
x = np.asarray(point_cloud[:,0])
y = np.asarray(point_cloud[:,1])
z = np.asarray(point_cloud[:,2])
M = np.vstack((x, y, z)) # 每行表示一个属性, 每列代表一个点
cov = np.cov(M) # 使用每个点的坐标求解cov
eigval, eigvec = np.linalg.eigh(cov) # 求解三个特征值,升序排列 linda1 < linda2 < linda3
eigval = eigval[np.argsort(-eigval)] # 改为降序排列 linda1 > linda2 > linda3
return eigval #返回特征值
matplotlib显示点云函数
# matplotlib显示点云函数
def Point_Cloud_Show(point_cloud,feature_point):
fig = plt.figure(dpi=150)
ax = fig.add_subplot(111, projection='3d')
ax.scatter(point_cloud[:, 0], point_cloud[:, 1], point_cloud[:, 2], cmap='spectral', s=2, linewidths=0, alpha=1, marker=".")
ax.scatter(feature_point[:, 0], feature_point[:, 1], feature_point[:, 2], cmap='spectral', s=2, linewidths=5, alpha=1,marker=".",color='red')
plt.title('Point Cloud')
ax.set_xlabel('x')
ax.set_ylabel('y')
ax.set_zlabel('z')
plt.show()
主体 iss