在本教程中,我们将展示如何检测三维形状的ISS关键点。该实现基于俞忠在2009年《Intrinsic Shape Signatures: A Shape Descriptor for 3D Object Recognition》中提出的关键点检测模块。
ISS关键点原理
ISS显著性度量是由对每个点所在的球形区域内的所有点的散射矩阵的特征值分解(EVD)决定的,即
在给定的情况下,其特征值从大到小表示为λ1,λ2,λ3。 在筛选关键点过程中,使两个连续特征值之比低于阈值,:
其基本原理是避免对沿主方向具有相似分布的点处检测关键点,因为在无法建立可重复的规范参考系的情况下,随后的描述阶段很难有效。在剩余的点中,显著性由最小特征值的大小决定(试想,如果临近点沿某个方向分布致密则该方向会作为椭球的第一主方向,稀疏的方向则是第二主方向,法线方向当然是极度稀疏(只有一层),那么则作为第三主方向。如果某个点恰好处于角点,则第一主特征值,第二主特征值,第三主特征值大小相差不会太大。如果点云沿着某方向致密,而垂直方向系数则有可能是边界):
在执行完上述检测步骤之后,如果某个点在给定的邻域上具有最大显著值,则该点将被视为关键点。
注意:有关更多详细信息,请参考原始出版物或Tombari等人的“Performance Evaluation of 3D Keypoint Detectors”。
代码展示
# -*-coding:utf-8 -*-
import numpy as np
import time
import open3d as o3d
import Open3D.examples.python.open3d_tutorial as o3dtut
# Compute ISS Keypoints on Armadillo
mesh = o3dtut.get_armadillo_mesh()
pcd = o3d.geometry.PointCloud()
pcd.points = mesh.vertices
tic = time.time()
keypoints = o3d.geometry.keypoint.compute_iss_keypoints(pcd)
toc = 1000 * (time.time() - tic)
print("ISS Computation took {:.0f} [ms]".format(toc))
mesh.compute_vertex_normals()
mesh.paint_uniform_color([0.5, 0.5, 0.5])
keypoints.paint_uniform_color([1.0, 0.75, 0.0])
o3d.visualization.draw_geometries([keypoints, mesh], front=[0, 0, -1.0])
# This function is only used to make the keypoints look better on the rendering
def keypoints_to_spheres(keypoints):
spheres = o3d.geometry.TriangleMesh()
for keypoint in keypoints.points:
sphere = o3d.geometry.TriangleMesh.create_sphere(radius=0.001)
sphere.translate(keypoint)
spheres += sphere
spheres.paint_uniform_color([1.0, 0.75, 0.0])
return spheres
# Compute ISS Keypoints on Standford Bunny, changing the default parameters
mesh = o3dtut.get_bunny_mesh()
pcd = o3d.geometry.PointCloud()
pcd.points = mesh.vertices
tic = time.time()
keypoints = o3d.geometry.keypoint.compute_iss_keypoints(pcd,
salient_radius=0.005,
non_max_radius=0.005,
gamma_21=0.5,
gamma_32=0.5)
toc = 1000 * (time.time() - tic)
print("ISS Computation took {:.0f} [ms]".format(toc))
mesh.compute_vertex_normals()
mesh.paint_uniform_color([0.5, 0.5, 0.5])
o3d.visualization.draw_geometries([keypoints_to_spheres(keypoints), mesh])