def background_removal(
         self, point_cloud: open3d.geometry.PointCloud
 ) -> open3d.geometry.PointCloud:
     plane, inliers = point_cloud.segment_plane(distance_threshold=0.005,
                                                ransac_n=4,
                                                num_iterations=250)
     return point_cloud.select_down_sample(inliers, invert=True)
Exemple #2
0
 def random_down_sample(pc: o3d.geometry.PointCloud, cnt):
     pc_cnt = np.asarray(pc.points).shape[0]
     if pc_cnt < cnt:
         raise ValueError("pc_cnt < sampling cnt")
     indices = np.arange(cnt)
     if pc_cnt != cnt:
         indices = np.random.choice(indices, size=cnt, replace=False)
     return pc.select_down_sample(indices)