Capturing point clouds with PCL tools

Capturing point clouds with PCL tools.

meshlab screenshot with point cloud

Installing PCL tools

Installing PCL tools is easy on most GNU/Linux distros as it should be available in your package manager. On Fedora run the following command:

sudo yum install pcl-tools

Capturing point clouds

To capture a point cloud in PCD format use the following command:

pcl_openni_grab_frame -paused

Press the left mouse button to save a frame or toggle continuous recording using space bar.

Converting to PLY

To open the point cloud in other applications, such as Blender and Meshlab, you will have to convert the generated PCD to PLY or another supported format.

To do this run the following command:

pcl_pcd2ply <input.pcd> <output.ply>

To process multiple files use the following with zsh:

for i in *.pcd ; do pcl_pcd2ply $i ${i:r}.ply ; done

The generated file uses meters as it's units. This works well in Blender but may need to be scaled in other applications.

Converting to ASCII

Some applications may not support binary PCD and PLY files, or you may want to pass the data manually using a script.

To convert PCD files to ASCII run the following command:

pcl_convert_pcd_ascii_binary <input.pcd> <output.pcd> 0

To convert PLY files I have found rply to be reliable:

sudo yum install rply

and run:

rply_convert -a <input.ply> <output.ply>

Scaling in Meshlab

Meshlab does not work well with the given scale (meters) at full resolution and works better with millimetres.

To fix this import the point cloud and scale it:

Filters > Normals, Curvatures and Orientations > Transform: Scale

Set the X Axis to 1000, Select Uniform Scaling and Freeze Matrix. Then select Apply. Press Ctrl+h to reset the model view.

Other useful tools

Other useful command are:

pcl_openni_save_image

which saves loads of RGB and depth images in tiff format.

Also:

pcl_openni_stream_compression -x -p highC -t -e -i 5 -f <pc_compressed.pcc>

which will create a compressed PCC file containing a point cloud steam. This tool has lots of parameters. To view the PCC file back run:

pcl_openni_stream_compression -d <pc_compressed.pcc>