最简单的方式,就是直接把原有的点云的数据的 z or x 赋值为0, 然后生成一个新的点云。
filename_model1 = r"1.pcd"down = 10point_cloud = o3d.io.read_point_cloud(filename_model1)
point_cloud = point_cloud.uniform_down_sample(int(down))
print('降采样后点云:', point_cloud)# asarray 会影响原有的数据!!!
point_cloud_xoy = np.array(point_cloud.points)
point_cloud_xoy[:, 2] = 0
pcdxoy = o3d.geometry.PointCloud() # 使用numpy生成点云
pcdxoy.points = o3d.utility.Vector3dVector(point_cloud_xoy) # points numpy数组
o3d.visualization.draw_geometries([pcdxoy])point_cloud_yoz = np.array(point_cloud.points)
point_cloud_yoz[:, 1] = 0
pcdyoz = o3d.geometry.PointCloud() # 使用numpy生成点云
pcdyoz.points = o3d.utility.Vector3dVector(point_cloud_yoz) # points numpy数组
o3d.visualization.draw_geometries([pcdyoz])