This page follows the Point Cloud Library’s description of PCD version 0.7, the
version PCL treats as official, and its reader, pcd_io.cpp. Earlier
versions (0.5, 0.6) date from before PCL 1.0; a file without a
VIEWPOINT line is read as version 0.6.
Header
The header is ASCII text, one entry per line, each line ended by a line feed. A line
starting with # is a comment. The entries must appear in this order:
| Entry | Values | Meaning |
|---|---|---|
VERSION | One | File version, such as 0.7 or .7 |
FIELDS | One per field | Field names, such as x y z rgb or normal_x normal_y normal_z. Older files may say COLUMNS. A field named _ is padding and is skipped |
SIZE | One per field | Bytes in one element of each field: 1, 2, 4 or 8 |
TYPE | One per field | I signed integer, U unsigned integer, F floating point |
COUNT | One per field | Elements in each field, such as 308 for a VFH descriptor histogram; 1 for each field if the line is missing |
WIDTH | One | Points per row of an organised cloud, or all the points of an unorganised one |
HEIGHT | One | Rows of an organised cloud, or 1 for an unorganised one |
VIEWPOINT | Seven | Sensor position tx ty tz and orientation as a quaternion qw qx qy qz; default 0 0 0 1 0 0 0 |
POINTS | One | Total number of points, WIDTH × HEIGHT |
DATA | One | ascii, binary or binary_compressed; the data starts right after this line |
Field types
| TYPE | SIZE | Meaning |
|---|---|---|
I | 1, 2, 4, 8 | int8, int16, int32, int64 |
U | 1, 2, 4, 8 | uint8, uint16, uint32, uint64 |
F | 4, 8 | float32, float64 |
The documentation lists sizes up to 4 for integers; 8-byte integers are accepted by recent PCL versions. Invalid values are usually stored as NaN.
Colour
PCL stores colour in one 4-byte field named rgb (or rgba)
whose bytes are the colour packed as 0x00RRGGBB (or
0xAARRGGBB). In binary data the four bytes are therefore blue, green,
red, then alpha or 0. Older files declare the field TYPE F, and in ASCII
write the bytes read as a float, such as 4.2108e+06; current PCL
declares rgb as TYPE U and writes the unsigned
integer.
Data forms
| DATA | Layout |
|---|---|
ascii | One point per line, values separated by spaces or tabs in field order, all COUNT elements of a field in turn. NaN is written nan |
binary | The points one after another, each point’s fields in order, little-endian as written on x86 computers, with no separators |
binary_compressed | A uint32 compressed size, a uint32 uncompressed size, then the data compressed with Marc Lehmann’s LZF |
Before compressing, binary_compressed reorders the data from one point
after another into one field after another: all the x values, then all the y values,
and so on (xyzxyzxyz becomes xxxyyyzzz). A reader decompresses and then puts each
point back together.
In an organised cloud the points are stored row by row, WIDTH points per
row.
Worked example
The header FIELDS x y z rgb, SIZE 4 4 4 4,
TYPE F F F U, DATA binary is followed by 16 bytes per
point:
| Bytes | Meaning |
|---|---|
00 00 80 3F | x = 1.0 |
00 00 00 40 | y = 2.0 |
00 00 00 00 | z = 0.0 |
00 80 FF 00 | rgb 0x00FF8000: red 255, green 128, blue 0 |