|
Point Cloud Library (PCL)
1.15.1-dev
|
Point Cloud Data (PCD) file format reader. More...
#include <pcl/io/pcd_io.h>
Inheritance diagram for pcl::PCDReader:
Collaboration diagram for pcl::PCDReader:Public Types | |
| enum | { PCD_V6 = 0 , PCD_V7 = 1 } |
| Various PCD file versions. More... | |
Public Member Functions | |
| PCDReader ()=default | |
| Empty constructor. More... | |
| ~PCDReader () override=default | |
| Empty destructor. More... | |
| int | readHeader (std::istream &binary_istream, pcl::PCLPointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &pcd_version, int &data_type, unsigned int &data_idx) |
| Read a point cloud data header from a PCD-formatted, binary istream. More... | |
| int | readHeader (const std::string &file_name, pcl::PCLPointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &pcd_version, int &data_type, unsigned int &data_idx, const int offset=0) override |
| Read a point cloud data header from a PCD file. More... | |
| int | readHeader (const std::string &file_name, pcl::PCLPointCloud2 &cloud, const int offset=0) |
| Read a point cloud data header from a PCD file. More... | |
| int | readBodyASCII (std::istream &stream, pcl::PCLPointCloud2 &cloud, int pcd_version) |
| Read the point cloud data (body) from a PCD stream. More... | |
| int | readBodyBinary (const unsigned char *data, pcl::PCLPointCloud2 &cloud, int pcd_version, bool compressed, unsigned int data_idx) |
| Read the point cloud data (body) from a block of memory. More... | |
| int | read (const std::string &file_name, pcl::PCLPointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &pcd_version, const int offset=0) override |
| Read a point cloud data from a PCD file and store it into a pcl/PCLPointCloud2. More... | |
| int | read (const std::string &file_name, pcl::PCLPointCloud2 &cloud, const int offset=0) |
| Read a point cloud data from a PCD (PCD_V6) and store it into a pcl/PCLPointCloud2. More... | |
| template<typename PointT > | |
| int | read (const std::string &file_name, pcl::PointCloud< PointT > &cloud, const int offset=0) |
| Read a point cloud data from any PCD file, and convert it to the given template format. More... | |
Public Member Functions inherited from pcl::FileReader | |
| FileReader ()=default | |
| empty constructor More... | |
| virtual | ~FileReader ()=default |
| empty destructor More... | |
| int | read (const std::string &file_name, pcl::PCLPointCloud2 &cloud, const int offset=0) |
| Read a point cloud data from a FILE file (FILE_V6 only!) and store it into a pcl/PCLPointCloud2. More... | |
| template<typename PointT > | |
| int | read (const std::string &file_name, pcl::PointCloud< PointT > &cloud, const int offset=0) |
| Read a point cloud data from any FILE file, and convert it to the given template format. More... | |
| anonymous enum |
Various PCD file versions.
PCD_V6 represents PCD files with version 0.6, which contain the following fields:
Everything that follows 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:
| Enumerator | |
|---|---|
| PCD_V6 | |
| PCD_V7 | |
|
default |
Empty constructor.
|
overridedefault |
Empty destructor.
| int pcl::PCDReader::read | ( | const std::string & | file_name, |
| pcl::PCLPointCloud2 & | cloud, | ||
| const int | offset = 0 |
||
| ) |
Read a point cloud data from a PCD (PCD_V6) and store it into a pcl/PCLPointCloud2.
PCD_V6 will generate a warning.
| [in] | file_name | the name of the file containing the actual PointCloud data |
| [out] | cloud | the resultant PointCloud message read from disk |
| [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). |
|
overridevirtual |
Read a point cloud data from a PCD file and store it into a pcl/PCLPointCloud2.
| [in] | file_name | the name of the file containing the actual PointCloud data |
| [out] | cloud | the resultant PointCloud message read from disk |
| [out] | origin | the sensor acquisition origin (only for > PCD_V7 - null if not present) |
| [out] | orientation | the sensor acquisition orientation (only for > PCD_V7 - identity if not present) |
| [out] | pcd_version | the PCD version of the file (either PCD_V6 or PCD_V7) |
| [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). |
Implements pcl::FileReader.
Referenced by pcl::gpu::DataSource::DataSource(), pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::insertRange(), pcl::io::loadPCDFile(), pcl::LineRGBD< PointXYZT, PointRGBT >::loadTemplates(), and pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::readRange().
|
inline |
Read a point cloud data from any PCD file, and convert it to the given template format.
| [in] | file_name | the name of the file containing the actual PointCloud data |
| [out] | cloud | the resultant PointCloud message read from disk |
| [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). |
Definition at line 277 of file pcd_io.h.
References pcl::fromPCLPointCloud2(), pcl::read(), pcl::PointCloud< PointT >::sensor_orientation_, and pcl::PointCloud< PointT >::sensor_origin_.
| int pcl::PCDReader::readBodyASCII | ( | std::istream & | stream, |
| pcl::PCLPointCloud2 & | cloud, | ||
| int | pcd_version | ||
| ) |
Read the point cloud data (body) from a PCD stream.
Reads the cloud points from a text-formatted stream. For use after readHeader(), when the resulting data_type == 0.
| [in] | stream | the stream from which to read the body. |
| [out] | cloud | the resultant point cloud dataset to be filled. |
| [in] | pcd_version | the PCD version of the stream (from readHeader()). |
| int pcl::PCDReader::readBodyBinary | ( | const unsigned char * | data, |
| pcl::PCLPointCloud2 & | cloud, | ||
| int | pcd_version, | ||
| bool | compressed, | ||
| unsigned int | data_idx | ||
| ) |
Read the point cloud data (body) from a block of memory.
Reads the cloud points from a binary-formatted memory block. For use after readHeader(), when the resulting data_type is nonzero.
| [in] | data | the memory location from which to read the body. |
| [out] | cloud | the resultant point cloud dataset to be filled. |
| [in] | pcd_version | the PCD version of the stream (from readHeader()). |
| [in] | compressed | indicates whether the PCD block contains compressed data. This should be true if the data_type returned by readHeader() == 2. |
| [in] | data_idx | the offset of the body, as reported by readHeader(). |
| int pcl::PCDReader::readHeader | ( | const std::string & | file_name, |
| pcl::PCLPointCloud2 & | cloud, | ||
| const int | offset = 0 |
||
| ) |
Read a point cloud data header from a PCD file.
Load only the meta information (number of points, their types, etc), and not the points themselves, from a given PCD file. Useful for fast evaluation of the underlying data structure.
| [in] | file_name | the name of the file to load |
| [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) |
| [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). |
|
overridevirtual |
Read a point cloud data header from a PCD file.
Load only the meta information (number of points, their types, etc), and not the points themselves, from a given PCD file. Useful for fast evaluation of the underlying data structure.
| [in] | file_name | the name of the file to load |
| [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) |
| [out] | origin | the sensor acquisition origin (only for > PCD_V7 - null if not present) |
| [out] | orientation | the sensor acquisition orientation (only for > PCD_V7 - identity if not present) |
| [out] | pcd_version | the PCD version of the file (i.e., PCD_V6, PCD_V7) |
| [out] | data_type | the type of data (0 = ASCII, 1 = Binary, 2 = Binary compressed) |
| [out] | data_idx | the offset of cloud data within the file |
| [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). |
Implements pcl::FileReader.
| int pcl::PCDReader::readHeader | ( | std::istream & | binary_istream, |
| pcl::PCLPointCloud2 & | cloud, | ||
| Eigen::Vector4f & | origin, | ||
| Eigen::Quaternionf & | orientation, | ||
| int & | pcd_version, | ||
| int & | data_type, | ||
| unsigned int & | data_idx | ||
| ) |
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.
| [in] | binary_istream | a std::istream with openmode set to std::ios::binary. |
| [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) |
| [out] | origin | the sensor acquisition origin (only for > PCD_V7 - null if not present) |
| [out] | orientation | the sensor acquisition orientation (only for > PCD_V7 - identity if not present) |
| [out] | pcd_version | the PCD version of the file (i.e., PCD_V6, PCD_V7) |
| [out] | data_type | the type of data (0 = ASCII, 1 = Binary, 2 = Binary compressed) |
| [out] | data_idx | the offset of cloud data within the file |
Referenced by pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::getDataSize(), and pcl::outofcore::OutofcoreOctreeDiskContainer< PointT >::OutofcoreOctreeDiskContainer().