@@ -213,7 +213,9 @@ def get_query_from_bbx(self, bbx, voxel_size, pad_voxel=0, skip_top_voxel=0):
213213 return coord , voxel_num_xyz , voxel_origin
214214
215215 def get_query_from_hor_slice (self , bbx , slice_z , voxel_size ):
216- """get grid query points inside a given bounding box (bbx) at slice height (slice_z)"""
216+ """
217+ get grid query points inside a given bounding box (bbx) at slice height (slice_z)
218+ """
217219 # bbx and voxel_size are all in the world coordinate system
218220 min_bound = bbx .get_min_bound ()
219221 max_bound = bbx .get_max_bound ()
@@ -246,7 +248,9 @@ def get_query_from_hor_slice(self, bbx, slice_z, voxel_size):
246248 return coord , voxel_num_xyz , voxel_origin
247249
248250 def get_query_from_ver_slice (self , bbx , slice_x , voxel_size ):
249- """get grid query points inside a given bounding box (bbx) at slice position (slice_x)"""
251+ """
252+ get grid query points inside a given bounding box (bbx) at slice position (slice_x)
253+ """
250254 # bbx and voxel_size are all in the world coordinate system
251255 min_bound = bbx .get_min_bound ()
252256 max_bound = bbx .get_max_bound ()
@@ -279,6 +283,9 @@ def get_query_from_ver_slice(self, bbx, slice_x, voxel_size):
279283 return coord , voxel_num_xyz , voxel_origin
280284
281285 def generate_sdf_map (self , coord , sdf_pred , mc_mask ):
286+ """
287+ Generate the SDF map for saving
288+ """
282289 device = o3d .core .Device ("CPU:0" )
283290 dtype = o3d .core .float32
284291 sdf_map_pc = o3d .t .geometry .PointCloud (device )
@@ -305,7 +312,9 @@ def generate_sdf_map(self, coord, sdf_pred, mc_mask):
305312 def generate_sdf_map_for_vis (
306313 self , coord , sdf_pred , mc_mask , min_sdf = - 1.0 , max_sdf = 1.0 , cmap = "bwr"
307314 ): # 'jet','bwr','viridis'
308-
315+ """
316+ Generate the SDF map for visualization
317+ """
309318 # do the masking or not
310319 if mc_mask is not None :
311320 coord = coord [mc_mask > 0 ]
@@ -392,6 +401,9 @@ def mc_mesh(self, mc_sdf, mc_mask, voxel_size, mc_origin):
392401 return verts , faces
393402
394403 def estimate_vertices_sem (self , mesh , verts , filter_free_space_vertices = True ):
404+ """
405+ Predict the semantic label of the vertices
406+ """
395407 if len (verts ) == 0 :
396408 return mesh
397409
@@ -413,6 +425,9 @@ def estimate_vertices_sem(self, mesh, verts, filter_free_space_vertices=True):
413425 return mesh
414426
415427 def estimate_vertices_color (self , mesh , verts ):
428+ """
429+ Predict the color of the vertices
430+ """
416431 if len (verts ) == 0 :
417432 return mesh
418433
@@ -430,7 +445,9 @@ def estimate_vertices_color(self, mesh, verts):
430445 return mesh
431446
432447 def filter_isolated_vertices (self , mesh , filter_cluster_min_tri = 300 ):
433- # print("Cluster connected triangles")
448+ """
449+ Cluster connected triangles and remove the small clusters
450+ """
434451 triangle_clusters , cluster_n_triangles , _ = mesh .cluster_connected_triangles ()
435452 triangle_clusters = np .asarray (triangle_clusters )
436453 cluster_n_triangles = np .asarray (cluster_n_triangles )
@@ -445,6 +462,9 @@ def filter_isolated_vertices(self, mesh, filter_cluster_min_tri=300):
445462 def generate_bbx_sdf_hor_slice (
446463 self , bbx , slice_z , voxel_size , query_locally = False , min_sdf = - 1.0 , max_sdf = 1.0
447464 ):
465+ """
466+ Generate the SDF slice at height (slice_z)
467+ """
448468 # print("Generate the SDF slice at heright %.2f (m)" % (slice_z))
449469 coord , _ , _ = self .get_query_from_hor_slice (bbx , slice_z , voxel_size )
450470 sdf_pred , _ , _ , mc_mask = self .query_points (
@@ -466,6 +486,9 @@ def generate_bbx_sdf_hor_slice(
466486 def generate_bbx_sdf_ver_slice (
467487 self , bbx , slice_x , voxel_size , query_locally = False , min_sdf = - 1.0 , max_sdf = 1.0
468488 ):
489+ """
490+ Generate the SDF slice at x position (slice_x)
491+ """
469492 # print("Generate the SDF slice at x position %.2f (m)" % (slice_x))
470493 coord , _ , _ = self .get_query_from_ver_slice (bbx , slice_x , voxel_size )
471494 sdf_pred , _ , _ , mc_mask = self .query_points (
@@ -499,6 +522,9 @@ def recon_aabb_collections_mesh(
499522 mesh_min_nn = 10 ,
500523 use_torch_mc = False ,
501524 ):
525+ """
526+ Reconstruct the mesh from a collection of bounding boxes
527+ """
502528 if not self .silence :
503529 print ("# Chunk for meshing: " , len (aabbs ))
504530
@@ -545,7 +571,9 @@ def recon_aabb_mesh(
545571 mesh_min_nn = 10 ,
546572 use_torch_mc = False ,
547573 ):
548-
574+ """
575+ Reconstruct the mesh from a given bounding box
576+ """
549577 # reconstruct and save the (semantic) mesh from the feature octree the decoders within a
550578 # given bounding box. bbx and voxel_size all with unit m, in world coordinate system
551579 coord , voxel_num_xyz , voxel_origin = self .get_query_from_bbx (
0 commit comments