import open3d as op3 import numpy as np import copy def read_and_show(): pcd = op3.io.read_point_cloud("demodata/PointCloudXYZRGB.ply") return pcd def downshape(pcd): downpcd = pcd.voxel_down_sample(voxel_size=0.00001) return downpcd #op3.io.write_point_cloud("pdc1",downpcd) def compute_normal_of_clound(pcd): pcd2 = copy.deepcopy(pcd) pcd2.estimate_normals(search_param=op3.geometry.KDTreeSearchParamHybrid( radius=0.01,max_nn=30)) # #op3.visualization.draw_geometries([pcd2]) return pcd2 #op3.io.write_point_cloud("pdc1",pcd2) if __name__ == "__main__": pcd = read_and_show() downpcd = downshape(pcd) op3.visualization.draw_geometries([pcd]) op3.visualization.draw_geometries([downpcd]) downpcd2 = compute_normal_of_clound(downpcd) #op3.visualization.draw_geometries([downpcd2]) print(downpcd.normals[0]) #print(downpcd2.normals[0]) print(pcd2.normals[0]) 这串代码有什么问题
时间: 2023-06-03 08:06:16 浏览: 193
24dianyouxi.rar_c 扑克牌_凑24
这段代码使用了 open3d 库,并导入了 numpy 和 copy。read_and_show 函数读取了名为 "PointCloudXYZRGB.ply" 的点云数据,并返回了点云对象。downshape 函数将输入的点云对象进行体素下采样,并返回下采样后的点云对象。
阅读全文