Search code examples
c++3dpoint-cloud-librarypoint-clouds

How to store/write the surface normals of a point cloud in a PCL data file?


I'm using PCL and I'm able to visualize the direction of the normals in real-time using PCL Visualizer.

When I store the point cloud I'm getting stored only the points but not the direction of the normals.

How could I store the direction of the normals in a PCD file, in order to visualize them using pcl_viewer?


Solution

  • You have to store the point cloud with the right point type.

    I'm guessing that you are sotring the cloud as pcl::PointXYZ, but what you should to is to store the cloud with a point type that support normal information, i.e pcl::PointNormal; or just store the normal information alone: pcl::Normal.

    Check this link for information about what Point Types are supported on PCL: http://pointclouds.org/documentation/tutorials/adding_custom_ptype.php#id3

    And chek the section 'Normals and other information' of this link for information on how to visualize the normals: http://pointclouds.org/documentation/tutorials/pcl_visualizer.php