MCPcopy Create free account
hub / github.com/RozDavid/UnScene3D / do_dbscan

Function do_dbscan

utils/cpp_utils/test/test_segmentor.py:8–26  ·  view source on GitHub ↗
(vertices, colors, faces)

Source from the content-addressed store, hash-verified

6import time
7
8def do_dbscan(vertices, colors, faces):
9 import hdbscan
10
11 # Do the same thing with DBScan
12 start = time.time()
13 dbscan_pcd = o3d.geometry.PointCloud()
14 dbscan_pcd.points = o3d.utility.Vector3dVector(vertices)
15 dbscan_pcd.colors = o3d.utility.Vector3dVector(colors)
16 dbscan_pcd.estimate_normals()
17
18 # HDBSCAN clustering
19 clusterer = hdbscan.HDBSCAN(min_cluster_size=500, min_samples=1)
20 clusterer.fit(np.concatenate((vertices, colors, np.array(dbscan_pcd.normals)), axis=1))
21 comps = clusterer.labels_
22
23 end_dbscan = time.time()
24 print(f"HDBSCAN took {end_dbscan - end_dbscan:.4f} s")
25
26 return comps, np.zeros((0, 2))
27
28def do_felzenszwalb(vertices, colors, faces, num_points):
29 import felzenszwalb_cpp

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected