print("Load a ply point cloud, print it, and render it") ply_point_cloud = o3d.data.PLYPointCloud() pcd = o3d.io.read_point_cloud(ply_point_cloud.path) print(pcd) print(np.asarray(pcd.points)) # to numpy array o3d.visualization.draw_geometries([pcd], zoom=0.3412, front=[0.4257, -0.2125, -0.8795], lookat=[2.6172, 2.0475, 1.532], up=[-0.0694, -0.9768, 0.2024])
使用-,+号可以调整点的大小
Voxel downsampling
1 2 3 4 5 6 7
print("Downsample the point cloud with a voxel of 0.05") downpcd = pcd.voxel_down_sample(voxel_size=0.05) o3d.visualization.draw_geometries([downpcd], zoom=0.3412, front=[0.4257, -0.2125, -0.8795], lookat=[2.6172, 2.0475, 1.532], up=[-0.0694, -0.9768, 0.2024])
Random downsampling
1
random_down_sample(self, sampling_ratio)
sampling_ratio (float) – Sampling ratio, the ratio of number of selected points to total number of points[0-1].