This document describes the PCD (Point Cloud Data) file format, and the way it is used inside Point Cloud Library (PCL).
The PCD file format is not meant to reinvent the wheel, but rather to complement existing file formats that for one reason or another did not/do not support some of the extensions that PCL brings to n-D point cloud processing.
PCD is not the first file type to support 3D point cloud data. The computer graphics and computational geometry communities in particular, have created numerous formats to describe arbitrary polygons and point clouds acquired using laser scanners. Some of these formats include:
All the above file formats suffer from several shortcomings, as explained in the next sections – which is natural, as they were created for a different purpose and at different times, before today’s sensing technologies and algorithms have been invented.
PCD file formats might have different revision numbers, prior to the release of Point Cloud Library (PCL) version 1.0. These are numbered with PCD_Vx (e.g., PCD_V5, PCD_V6, PCD_V7, etc) and represent version numbers 0.x for the PCD file.
The official entry point for the PCD file format in PCL however should be version 0.7 (PCD_V7).
Each PCD file contains a header that identifies and declares certain properties of the point cloud data stored in the file. The header of a PCD must be encoded in ASCII.
Note
Each header entry as well as ascii point data (see below) specified in a PCD file, is separated using new lines (\n).
As of version 0.7, the PCD header contains the following entries:
VERSION - specifies the PCD file version
FIELDS - specifies the name of each dimension/field that a point can have. Examples:
SIZE - specifies the size of each dimension in bytes. Examples:
TYPE - specifies the type of each dimension as a char. The current accepted types are:
COUNT - specifies how many elements does each dimension have. For example, x data usually has 1 element, but a feature descriptor like theVFH has 308. Basically this is a way to introduce n-D histogram descriptors at each point, and treating them as a single contiguous block of memory. By default, if COUNT is not present, all dimensions’ count is set to 1.
WIDTH - specifies the width of the point cloud dataset in the number of points. WIDTH has two meanings:
Also see HEIGHT.
Note
An organized point cloud dataset is the name given to point clouds that resemble an organized image (or matrix) like structure, where the data is split into rows and columns. Examples of such point clouds include data coming from stereo cameras or Time Of Flight cameras. The advantages of a organized dataset is that by knowing the relationship between adjacent points (e.g. pixels), nearest neighbor operations are much more efficient, thus speeding up the computation and lowering the costs of certain algorithms in PCL.
Examples:
HEIGHT - specifies the height of the point cloud dataset in the number of points. HEIGHT has two meanings:
Example:
Example:
VIEWPOINT - specifies an acquisition viewpoint for the points in the dataset. This could potentially be later on used for building transforms between different coordinate systems, or for aiding with features such as surface normals, that need a consistent orientation.
The viewpoint information is specified as a translation (tx ty tz) + quaternion (qw qx qy qz). The default value is:
POINTS - specifies the total number of points in the cloud. As of version 0.7, its purpose is a bit redundant, so we’re expecting this to be removed in future versions.
Example:
DATA - specifies the data type that the point cloud data is stored in. As of version 0.7, two data types are supported: ascii and binary. See the next section for more details.
Note
The next bytes directly after the header’s last line (DATA) are considered part of the point cloud data, and will be interpreted as such.
Warning
The header entries must be specified precisely in the above order, that is:
As of version 0.7, the .PCD file format uses two different modes for storing data:
in ASCII form, with each point on a new line:
Note
Starting with PCL version 1.0.1 the string representation for NaN is “nan”.
Storing point cloud data in both a simple ascii form with each point on a line, space or tab separated, without any other characters on it, as well as in a binary dump format, allows us to have the best of both worlds: simplicity and speed, depending on the underlying application. The ascii format allows users to open up point cloud files and plot them using standard software tools like gnuplot or manipulate them using tools like sed, awk, etc.
Having PCD as (yet another) file format can be seen as PCL suffering from the not invented here syndrome. In reality, this is not the case, as none of the above mentioned file formats offers the flexibility and speed of PCD files. Some of the clearly stated advantages include:
An additional advantage is that by controlling the file format, we can best adapt it to PCL, and thus obtain the highest performance with respect to PCL applications, rather than adapting a different file format to PCL as the native type and inducing additional delays through conversion functions.
Note
Though PCD (Point Cloud Data) is the native file format in PCL, the pcl_io library should offer the possibility to save and load data in all the other aforementioned file formats too.
A snippet of a PCD file is attached below. It is left to the reader to interpret the data and see what it means. :) Have fun!: