<>1 What is? PCD?
PCD（Point Cloud Date, Point cloud data ） The corresponding file format is （*.pcd）, yes PCL Official format , have ASCII and binary
Two types of data storage ,pcd The format has a header , Used to describe the overall information of the point cloud .
<>2 pcd Example of file header
# .PCD v0.7 - Point Cloud Data file format VERSION 0.7 FIELDS x y z SIZE 4 4 4
TYPE F F F COUNT1 1 1 WIDTH 278 HEIGHT 1 VIEWPOINT 0 0 0 1 0 0 0 POINTS 278
<>3 File header format description
In point cloud Library （PCL）1.0 Before release ,PCD The file format has different revision numbers . These amendments are marked with PCD_Vx Come and number （ for example ,PCD_V5,PCD_V6,PCD_V7 wait ）, representative PCD Of documents 0.x Version number . however PCL in PCD The official release of the file format is 0.7 edition （PCD_V7）.
every last PCD The file contains a header , It identifies and declares certain characteristics of the point cloud data stored in the file .PCD File header must be ASCII It's coded by the code .PCD Each header field specified in the file and ascii Point data are all in a new row （\n） Separated , from 0.7 Version start ,PCD The header contains the following fields ：
* VERSION ------ appoint PCD File version
* FIELDS ------ Specify the name of each dimension and field that a point can have , for example ： FIELDS x y z // XYZ data FIELDS x y
z rgb// XYZ + colors FIELDS x y z normal_xnormal_y normal_z // XYZ + surface
normals FIELDS j1 j2 j3 // moment invariants
* SIZE ------ Specifies the size of each dimension in bytes , for example ：
unsigned char/char // 1 byte
unsigned short/short // 2 bytes
unsigned int/int/float // 4 bytes
double // 8 bytes
* TYPE ------ Use one character to specify the type of each dimension , What are the accepted types ：
I – Represents a signed type int8（char）,int16（short） and int32（int）;
U – Represents an unsigned type uint8（unsigned char）,uint16（unsigned short） and uint32（unsigned int）;
F – Represents a floating point type .
* COUNT ------ Specifies the number of elements contained in each dimension .
for example ,x This data usually has one element , But like VFH Such feature descriptors have some advantages 308 individual . In fact, it's introducing each point n A new method of using two dimensional histogram descriptors , Think of them as a single contiguous block . By default , without COUNT, The number of all dimensions is set to 1.
* WIDTH ------ The width of the point cloud dataset is represented by the number of points .
It depends on whether it is an ordered or unordered point cloud ,WIDTH There are two explanations ：
1) It can determine the number of points in point cloud of unordered data set （ And below POINTS equally ）;
2) It can determine the width of the ordered point cloud data set （ The number of points in a row ）.
be careful ： Ordered point cloud dataset , It means that the point cloud is similar to the image （ Or matrix ） The structure of , Data is divided into rows and columns . Examples of such point clouds include data generated by stereo cameras and time-of-flight cameras . The advantages of ordered data sets are , Know adjacent points in advance （ It's like pixels ） The relationship between , More efficient neighborhood operation , This speeds up the calculation and reduces the cost PCL The cost of some algorithms in .
for example ：
WIDTH 640 # Each line has 640 A point
* HEIGHT ------ The height of a point cloud dataset is represented by the number of points .
be similar to WIDTH ,HEIGHT There are two explanations ：
1) It represents the height of the ordered point cloud dataset （ Total number of rows ）;
2) For unordered datasets, it is set to 1（ Is used to check whether a data set is ordered or unordered ）.
An example of ordered point cloud ：
WIDTH 640 # An ordered structure like an image , yes 640 Xinghe 480 column ,
HEIGHT 480 # In this way, the dataset has 640*480=307200 A point
Unordered point cloud example ：
HEIGHT 1 # yes 307200 Unordered point cloud dataset with points
* VIEWPOINT ------ Specifies the acquisition viewpoint of the point cloud in the dataset .
VIEWPOINT It may be used in the conversion between different coordinate systems , It is also useful in obtaining other features , For example, surface normals , When judging the direction consistency , You need to know where the viewpoint is ,
Viewpoint information is specified as translation （tx, ty, tz）+ Quaternion （qw, qx, qy, qz）. The default value is ：
VIEWPOINT 0 0 0 1 0 0 0
* POINTS ------ Specifies the total number of points in the point cloud .
from 0.7 Version start , This field is a bit redundant , So it's possible to remove it in a future release .
POINTS 307200 # The total number of points in the point cloud is 307200
* DATA ------ Specifies the data type to store the point cloud data .
from 0.7 Version start , Two data types are supported ：：ASCII Form and binary form
be careful ： Last line of header （DATA） The next byte of the cloud is regarded as the data part of the point cloud , It will be interpreted as point cloud data .
warning ：PCD The header of the file must be specified exactly in the order above , That is, in the following order ：
VERSION,FIELDS,SIZE,TYPE,COUNT,WIDTH,HEIGHT,VIEWPOINT,POINTS,DATA , Separate them with line breaks .
Data storage type
stay 0.7 In version ,.PCD File formats store data in two modes
* ASCII form , Each point occupies a new line ： # .PCD v0.7 - Point Cloud Data file format VERSION 0.7
FIELDS x y z SIZE4 4 4 TYPE F F F COUNT 1 1 1 WIDTH 89 HEIGHT 1 VIEWPOINT 0 0 0
1 0 0 0 POINTS 89 DATA ascii -21.368 -137.98199 -23 -21.301001 -137.745 -23 -
21.257 -137.52699 -23 -21.219999 -137.34801 -23 -21.153 -137.12399 -23 -
21.117001 -136.967 -23 -21.066999 -136.71001 -23 -20.999001 -136.47301 -23 -
20.954 -136.23599 -23 -20.882 -135.97501 -23 ...
* Binary (binary) form
Here the data is an array （ vector ）pcl::PointCloud.points A full copy of , than ASCII Fast code form , but txt Text open , Point data is garbled .