在本教程中,我们将展示如何检测 3D 形状的 ISS 关键点。该实现基于于忠提出的关键点检测模块,“内在形状特征:用于3D对象识别的形状描述符”,2009年。( Yu Zhong , “Intrinsic Shape Signatures: A Shape Descriptor for 3D Object Recognition)
ISS 显著性测度基于属于
p
p
p的点的散射矩阵
Σ
(
p
)
Σ(p)
Σ(p)的特征值分解(EVD)。
Σ
(
p
)
=
1
N
∑
q
∈
N
(
p
)
(
q
−
μ
p
)
(
q
−
μ
p
)
T
w
i
t
h
μ
p
=
1
N
∑
q
∈
N
(
p
)
q
Σ(p)=\frac{1}{N}∑_{q∈N(p)}(q−μ_p)(q−μ_p)T with μ_p=\frac{1}{N}∑_{q∈N(p)}q
Σ(p)=N1q∈N(p)∑(q−μp)(q−μp)Twithμp=N1q∈N(p)∑q
给定
Σ
(
p
)
Σ(p)
Σ(p),其数量级数量级递减的特征值在这里表示为 λ1、λ2、λ3。在修剪阶段,保留两个连续特征值之间比率低于阈值的点:
λ
2
(
p
)
λ
1
(
p
)
<
γ
12
∧
λ
3
(
p
)
λ
2
(
p
)
<
γ
23
\frac{λ2(p)}{λ1(p)}<γ_{12}∧\frac{λ3(p)}{λ2(p)}<γ_{23}
λ1(p)λ2(p)<γ12∧λ2(p)λ3(p)<γ23
其基本原理是避免在沿主要方向表现出类似扩散的点上检测关键点,在这些点上无法建立可重复的规范参考系,因此,随后的描述阶段很难变得有效。在其余点中,显著性由最小特征值的大小决定
ρ
(
p
)
≐
λ
3
(
p
)
ρ(p)≐λ3(p)
ρ(p)≐λ3(p)
以便仅包括沿每个主方向变化较大的点。
在检测步骤之后,如果某个点在给定邻域上具有最大显著性值,则该点将被视为关键点。
注意:有关更多详细信息,请参考原始出版物或Tombari et.al 的“3D关键点探测器的性能评估”(Performance Evaluation of 3D Keypoint Detectors)。
#Intrinsic shape siqnatures
import open3d as o3d
import time
# Compute ISS Keypoints on ArmadilloMesh
armadillo_path = r'../data/ArmadilloMesh.ply'
mesh = o3d.io.read_triangle_mesh(armadillo_path)
mesh.compute_vertex_normals()
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])
# 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 BunnyMesh, changing the default parameters
bunny_path = r'../data/BunnyMesh.ply'
mesh = o3d.io.read_triangle_mesh(bunny_path)
mesh.compute_vertex_normals()
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])