Public Types | Public Member Functions

pcl::PCDReader Class Reference
[Module io]

Point Cloud Data (PCD) file format reader. More...

#include <pcl/io/pcd_io.h>

List of all members.

Public Types

enum  { PCD_V6 = 0, PCD_V7 = 1 }
 

Various PCD file versions.

More...

Public Member Functions

int readHeader (const std::string &file_name, sensor_msgs::PointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &pcd_version, bool &binary_data, int &data_idx)
 Read a point cloud data header from a PCD file.
int read (const std::string &file_name, sensor_msgs::PointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &pcd_version)
 Read a point cloud data from a PCD file and store it into a sensor_msgs/PointCloud2.
int read (const std::string &file_name, sensor_msgs::PointCloud2 &cloud)
 Read a point cloud data from a PCD file (PCD_V6 only!) and store it into a sensor_msgs/PointCloud2.
template<typename PointT >
int read (const std::string &file_name, pcl::PointCloud< PointT > &cloud)
 Read a point cloud data from any PCD file, and convert it to the given template format.
template<typename Type >
void copyStringValue (const std::string &st, sensor_msgs::PointCloud2 &cloud, unsigned int point_index, unsigned int field_idx, unsigned int fields_count)
 Copy one single value of type T (uchar, char, uint, int, float, double, ...) from a string.

Detailed Description

Point Cloud Data (PCD) file format reader.

Author:
Radu Bogdan Rusu

Definition at line 109 of file pcd_io.h.


Member Enumeration Documentation

anonymous enum

Various PCD file versions.

PCD_V6 represents PCD files with version .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 DATA is intepreted as data points and will be read accordingly.

PCD_V7 represents PCD files with version .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
Enumerator:
PCD_V6 
PCD_V7 

Definition at line 136 of file pcd_io.h.


Member Function Documentation

template<typename Type >
void pcl::PCDReader::copyStringValue ( const std::string &  st,
sensor_msgs::PointCloud2 cloud,
unsigned int  point_index,
unsigned int  field_idx,
unsigned int  fields_count 
) [inline]

Copy one single value of type T (uchar, char, uint, int, float, double, ...) from a string.

Uses aoti/atof to do the conversion. Checks if the st is "nan" and converts it accordingly.

Parameters:
st the string containing the value to convert and copy
cloud the cloud to copy it to
point_index the index of the point
field_idx the index of the dimension/field
fields_count the current fields count

Definition at line 219 of file pcd_io.h.

template<typename PointT >
int pcl::PCDReader::read ( const std::string &  file_name,
pcl::PointCloud< PointT > &  cloud 
) [inline]

Read a point cloud data from any PCD file, and convert it to the given template format.

Parameters:
file_name the name of the file containing the actual PointCloud data
cloud the resultant PointCloud message read from disk

Definition at line 193 of file pcd_io.h.

int pcl::PCDReader::read ( const std::string &  file_name,
sensor_msgs::PointCloud2 cloud,
Eigen::Vector4f &  origin,
Eigen::Quaternionf &  orientation,
int &  pcd_version 
)

Read a point cloud data from a PCD file and store it into a sensor_msgs/PointCloud2.

Parameters:
file_name the name of the file containing the actual PointCloud data
cloud the resultant PointCloud message read from disk
origin the sensor acquisition origin (only for > PCD_V7 - null if not present)
orientation the sensor acquisition orientation (only for > PCD_V7 - identity if not present)
pcd_version the PCD version of the file (either PCD_V6 or PCD_V7)
int pcl::PCDReader::read ( const std::string &  file_name,
sensor_msgs::PointCloud2 cloud 
)

Read a point cloud data from a PCD file (PCD_V6 only!) and store it into a sensor_msgs/PointCloud2.

Note:
This function is provided for backwards compatibility only and it can only read PCD_V6 files correctly, as sensor_msgs::PointCloud2 does not contain a sensor origin/orientation. Reading any file > PCD_V6 will generate a warning.
Parameters:
file_name the name of the file containing the actual PointCloud data
cloud the resultant PointCloud message read from disk
int pcl::PCDReader::readHeader ( const std::string &  file_name,
sensor_msgs::PointCloud2 cloud,
Eigen::Vector4f &  origin,
Eigen::Quaternionf &  orientation,
int &  pcd_version,
bool &  binary_data,
int &  data_idx 
)

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.

Returns: * < 0 (-1) on error * > 0 on success

Parameters:
file_name the name of the file to load
cloud the resultant point cloud dataset (only the header will be filled)
origin the sensor acquisition origin (only for > PCD_V7 - null if not present)
orientation the sensor acquisition orientation (only for > PCD_V7 - identity if not present)
pcd_version the PCD version of the file (either PCD_V6 or PCD_V7)
binary_data is true if the PCD file contains binary data, false if ascii
data_idx the offset of cloud data within the file

The documentation for this class was generated from the following file: