Point Cloud Library (PCL)  1.3.1
Public Types | Public Member Functions
pcl::PCDReader Class Reference

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

#include <pcl/io/pcd_io.h>

Inheritance diagram for pcl::PCDReader:
Inheritance graph
[legend]
Collaboration diagram for pcl::PCDReader:
Collaboration graph
[legend]

List of all members.

Public Types

enum  { PCD_V6 = 0, PCD_V7 = 1 }
 Various PCD file versions. More...

Public Member Functions

 PCDReader ()
 Empty constructor.
 ~PCDReader ()
 Empty destructor.
int readHeader (const std::string &file_name, sensor_msgs::PointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &pcd_version, int &data_type, 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 (PCD_V6) 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

Member Enumeration Documentation

anonymous enum

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 DATA is intepreted 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
Enumerator:
PCD_V6 
PCD_V7 

Definition at line 82 of file pcd_io.h.


Constructor & Destructor Documentation

pcl::PCDReader::PCDReader ( ) [inline]

Empty constructor.

Definition at line 55 of file pcd_io.h.

pcl::PCDReader::~PCDReader ( ) [inline]

Empty destructor.

Definition at line 57 of file pcd_io.h.


Member Function Documentation

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

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:
stthe string containing the value to convert and copy
cloudthe cloud to copy it to
point_indexthe index of the point
field_idxthe index of the dimension/field
fields_countthe current fields count

Definition at line 144 of file file_io.h.

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

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

Parameters:
[in]file_namethe name of the file containing the actual PointCloud data
[out]cloudthe resultant PointCloud message read from disk
[out]originthe sensor acquisition origin (only for > PCD_V7 - null if not present)
[out]orientationthe sensor acquisition orientation (only for > PCD_V7 - identity if not present)
[out]pcd_versionthe PCD version of the file (either PCD_V6 or PCD_V7)

Implements pcl::FileReader.

int pcl::PCDReader::read ( const std::string &  file_name,
sensor_msgs::PointCloud2 cloud 
)

Read a point cloud data from a PCD (PCD_V6) 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:
[in]file_namethe name of the file containing the actual PointCloud data
[out]cloudthe resultant PointCloud message read from disk

Reimplemented from pcl::FileReader.

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:
[in]file_namethe name of the file containing the actual PointCloud data
[out]cloudthe resultant PointCloud message read from disk

Reimplemented from pcl::FileReader.

Definition at line 139 of file pcd_io.h.

int pcl::PCDReader::readHeader ( const std::string &  file_name,
sensor_msgs::PointCloud2 cloud,
Eigen::Vector4f &  origin,
Eigen::Quaternionf &  orientation,
int &  pcd_version,
int &  data_type,
int &  data_idx 
) [virtual]

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:
[in]file_namethe name of the file to load
[out]cloudthe resultant point cloud dataset (only the header will be filled)
[out]originthe sensor acquisition origin (only for > PCD_V7 - null if not present)
[out]orientationthe sensor acquisition orientation (only for > PCD_V7 - identity if not present)
[out]pcd_versionthe PCD version of the file (either PCD_V6 or PCD_V7)
[out]data_typethe type of data (0 = ASCII, 1 = Binary, 2 = Binary compressed)
[out]data_idxthe offset of cloud data within the file

Implements pcl::FileReader.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines