python-pcl计算点云法向量

import pcl
import pcl.pcl_visualization

def main():
    cloud = pcl.load('output/003784.pcd')
    print('load output/003784.pcd')
    
    ne = cloud.make_NormalEstimation()
    ne.set_KSearch(20)
    normals = ne.compute()
    # the normal is stored in the first 3 components (0-2), and the curvature is stored in component 3
    
    viewer = pcl.pcl_visualization.PCLVisualizering()
    viewer.SetBackgroundColor(0.0, 0.0, 0.5)
    viewer.AddPointCloud(cloud)
    viewer.AddPointCloudNormals(cloud, normals, 10, 0.05, b'normals')

    flag = True
    while flag:
        flag = not(viewer.WasStopped())
        viewer.SpinOnce()

if __name__ == "__main__":
    main()

你可能感兴趣的:(python,#,python-pcl,python)