mrdja.pointcloud.get_pointcloud_after_substracting_point_cloud
- mrdja.pointcloud.get_pointcloud_after_substracting_point_cloud(pcd: PointCloud, substract: PointCloud, threshold: float = 0.05) PointCloud[source]
Substracts one pointcloud from another. It removes all the points of the first pointcloud that are closer than threshold to some point of the second pointcloud.
- Parameters:
pcd (o3d.geometry.PointCloud) – Pointcloud to substract from.
substract (o3d.geometry.PointCloud) – Pointcloud to substract.
threshold (float) – If a point of the first pointcloud is closer to some point of the second pointcloud than this value, the point is removed.
- Returns:
The results after substracting the second pointcloud from the first pointcloud.
- Return type:
o3d.geometry.PointCloud
- Example:
>>> import mrdja.pointcloud as pointcloud >>> import open3d as o3d >>> import numpy as np >>> np.random.seed(42) >>> mesh_box = o3d.geometry.TriangleMesh.create_box(width=1.0, height=5.0, depth=1.0) >>> pcd_1 = mesh_box.sample_points_uniformly(number_of_points = 10000) >>> mesh_box = o3d.geometry.TriangleMesh.create_box(width=1.5, height=4.0, depth=0.5) >>> pcd_2 = mesh_box.sample_points_uniformly(number_of_points = 10000) >>> pcd_1.paint_uniform_color([1, 0, 0]) >>> pcd_2.paint_uniform_color([0, 1, 0]) >>> pcd_1_minus_pcd_2 = pointcloud.get_pointcloud_after_substracting_point_cloud(pcd_1, pcd_2, threshold = 0.02) >>> pcd_1_minus_pcd_2 PointCloud with 5861 points. >>> o3d.visualization.draw_geometries([pcd_1, pcd_2]) >>> o3d.visualization.draw_geometries([pcd_1_minus_pcd_2]) >>> pcd_2_minus_pcd_1 = pointcloud.get_pointcloud_after_substracting_point_cloud(pcd_2, pcd_1, threshold = 0.02) >>> pcd_2_minus_pcd_1 PointCloud with 4717 points. >>> o3d.visualization.draw_geometries([pcd_2_minus_pcd_1])