-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDocs_Geometry_Intrinsic_Shape_Signatures.py
53 lines (43 loc) · 2.1 KB
/
Docs_Geometry_Intrinsic_Shape_Signatures.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import open3d as o3d
import python.open3d_tutorial as o3dtut
import time
# http://www.open3d.org/docs/release/tutorial/geometry/iss_keypoint_detector.html
########################################################################################################################
# 1. Intrinsic shape signatures (ISS)
########################################################################################################################
# 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], width=800, height=600)
# 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], width=800, height=600)