/** \brief Various PCD file versions. * * PCD_V6 represents PCD files with version 0.6, which contain the following fields: * - lines beginning with # are treated as comments * - FIELDS ... * - SIZE ... * - TYPE ... * - COUNT ... * - WIDTH ... * - HEIGHT ... * - POINTS ... * - DATA ascii/binary * * Everything that follows \b DATA is interpreted as data points and * will be read accordingly. * * PCD_V7 represents PCD files with version 0.7 and has an important * addon: it adds sensor origin/orientation (aka viewpoint) information * to a dataset through the use of a new header field: * - VIEWPOINT tx ty tz qw qx qy qz */
时间: 2024-02-14 18:20:23 浏览: 103
这段代码是对PCD文件版本的说明文档。PCD_V6表示版本为0.6的PCD文件,它包含以下字段:
- 以#开头的行被视为注释
- FIELDS ...
- SIZE ...
- TYPE ...
- COUNT ...
- WIDTH ...
- HEIGHT ...
- POINTS ...
- DATA ascii/binary
在 \b DATA 之后的所有内容都会被解释为数据点,并相应地读取。
PCD_V7表示版本为0.7的PCD文件,并且增加了一个重要的附加信息:通过使用新的头字段,将传感器的起始位置/方向(也称为视点)信息添加到数据集中:
- VIEWPOINT tx ty tz qw qx qy qz
相关问题
/** \brief Read a point cloud data header from a PCD-formatted, binary istream. * * Load only the meta information (number of points, their types, etc), * and not the points themselves, from a given PCD stream. Useful for fast * evaluation of the underlying data structure. * * \attention The PCD data is \b always stored in ROW major format! The * read/write PCD methods will detect column major input and automatically convert it. * * \param[in] binary_istream a std::istream with openmode set to std::ios::binary. * \param[out] cloud the resultant point cloud dataset (only these * members will be filled: width, height, point_step, * row_step, fields[]; data is resized but not written) * \param[out] origin the sensor acquisition origin (only for > PCD_V7 - null if not present) * \param[out] orientation the sensor acquisition orientation (only for > PCD_V7 - identity if not present) * \param[out] pcd_version the PCD version of the file (i.e., PCD_V6, PCD_V7) * \param[out] data_type the type of data (0 = ASCII, 1 = Binary, 2 = Binary compressed) * \param[out] data_idx the offset of cloud data within the file * * \return * * < 0 (-1) on error * * == 0 on success
这段代码是用于从PCD格式的二进制输入流中读取点云数据头的函数。它仅加载元信息(点数、类型等),而不加载点云本身,因此可以用于快速评估底层数据结构。
需要注意的是,PCD数据始终以行优先(ROW major)的格式存储!读/写PCD方法将检测列优先(column major)的输入并自动进行转换。
该函数的参数包括:
- binary_istream:用 std::ios::binary 打开的二进制输入流。
- cloud:点云数据集的结果(只有以下成员将被填充:width,height,point_step,row_step,fields[];数据将被调整大小但不会被写入)。
- origin:传感器采集原点(仅适用于 > PCD_V7 版本 - 如果不存在则为 null)。
- orientation:传感器采集方向(仅适用于 > PCD_V7 版本 - 如果不存在则为 identity)。
- pcd_version:文件的PCD版本(即,PCD_V6,PCD_V7)。
- data_type:数据类型(0 = ASCII,1 = 二进制,2 = 压缩二进制)。
- data_idx:文件中点云数据的偏移量。
该函数返回值为:
- < 0(-1):表示错误
- == 0:表示成功
read (const std::string &file_name, pcl::PCLPointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &pcd_version, const int offset = 0) override; /** \brief Read a point cloud data from a PCD (PCD_V6) and store it into a pcl/PCLPointCloud2. * * \note This function is provided for backwards compatibility only and * it can only read PCD_V6 files correctly, as pcl::PCLPointCloud2 * does not contain a sensor origin/orientation. Reading any file * > PCD_V6 will generate a warning. * * \param[in] file_name the name of the file containing the actual PointCloud data * \param[out] cloud the resultant PointCloud message read from disk * \param[in] offset the offset of where to expect the PCD Header in the * file (optional parameter). One usage example for setting the offset * parameter is for reading data from a TAR "archive containing multiple * PCD files: TAR files always add a 512 byte header in front of the * actual file, so set the offset to the next byte after the header * (e.g., 513). * * \return * * < 0 (-1) on error * * == 0 on success */
这是 PCL 中的一个文件读取函数,用于读取 PCD_V6 格式的点云文件,并将点云数据存储在一个 `pcl::PCLPointCloud2` 对象中。此函数提供了向后兼容性,因为它可以读取 PCD_V6 文件,但不包含传感器原点/方向信息。读取任何 PCD_V6 以上版本的文件都会生成警告。
该函数的参数及其含义如下:
- `file_name`:点云文件名。
- `cloud`:用于存储点云数据的 `pcl::PCLPointCloud2` 对象。
- `origin`:点云数据的原点坐标。
- `orientation`:点云数据的传感器方向。
- `pcd_version`:点云数据的 PCD 版本号。
- `offset`:PCD 文件头的偏移量,用于读取 TAR 存档文件中的多个 PCD 文件。
该函数的返回值:
- `< 0`:读取失败。
- `0`:读取成功。
需要注意的是,该函数不会自动释放 `cloud` 对象的内存空间,需要在使用完毕后手动释放。
阅读全文