Point Cloud Library (PCL)  1.4.0
Classes | Functions
Module io

Detailed Description

Overview

The pcl_io library contains classes and functions for reading and writing point cloud data and capturing from OpenNI-compatible depth cameras. An introduction to some of these capabilities can be found in the following tutorials.

Requirements

Classes

class  pcl::FileReader
 Point Cloud Data (FILE) file format reader interface. More...
class  pcl::FileWriter
 Point Cloud Data (FILE) file format writer. More...
class  pcl::Grabber
 Grabber interface for PCL 1.x device drivers. More...
class  pcl::PCDGrabberBase
 Base class for PCD file grabber. More...
class  pcl::PCDReader
 Point Cloud Data (PCD) file format reader. More...
class  pcl::PCDWriter
 Point Cloud Data (PCD) file format writer. More...
class  pcl::PCLIOException
 Base exception class for I/O operations. More...
class  pcl::PLYReader
 Point Cloud Data (PLY) file format reader. More...
class  pcl::PLYWriter
 Point Cloud Data (PLY) file format writer. More...

Functions

int pcl::getFieldIndex (const sensor_msgs::PointCloud2 &cloud, const std::string &field_name)
 Get the index of a specified field (i.e., dimension/channel)
template<typename PointT >
int pcl::getFieldIndex (const pcl::PointCloud< PointT > &cloud, const std::string &field_name, std::vector< sensor_msgs::PointField > &fields)
 Get the index of a specified field (i.e., dimension/channel)
template<typename PointT >
void pcl::getFields (const pcl::PointCloud< PointT > &cloud, std::vector< sensor_msgs::PointField > &fields)
 Get the list of available fields (i.e., dimension/channel)
template<typename PointT >
std::string pcl::getFieldsList (const pcl::PointCloud< PointT > &cloud)
 Get the list of all fields available in a given cloud.
std::string pcl::getFieldsList (const sensor_msgs::PointCloud2 &cloud)
 Get the available point cloud fields as a space separated string.
int pcl::getFieldSize (const int datatype)
 Obtains the size of a specific field data type in bytes.
int pcl::getFieldType (const int size, char type)
 Obtains the type of the PointField from a specific size and type.
char pcl::getFieldType (const int type)
 Obtains the type of the PointField from a specific PointField as a char.
template<typename PointInT , typename PointOutT >
void pcl::copyPointCloud (const pcl::PointCloud< PointInT > &cloud_in, pcl::PointCloud< PointOutT > &cloud_out)
 Copy all the fields from a given point cloud into a new point cloud.
PCL_EXPORTS bool pcl::concatenatePointCloud (const sensor_msgs::PointCloud2 &cloud1, const sensor_msgs::PointCloud2 &cloud2, sensor_msgs::PointCloud2 &cloud_out)
 Concatenate two sensor_msgs::PointCloud2.
PCL_EXPORTS void pcl::copyPointCloud (const sensor_msgs::PointCloud2 &cloud_in, const std::vector< int > &indices, sensor_msgs::PointCloud2 &cloud_out)
 Extract the indices of a given point cloud as a new point cloud.
template<typename PointT >
void pcl::copyPointCloud (const pcl::PointCloud< PointT > &cloud_in, const std::vector< int > &indices, pcl::PointCloud< PointT > &cloud_out)
 Extract the indices of a given point cloud as a new point cloud.
template<typename PointT >
void pcl::copyPointCloud (const pcl::PointCloud< PointT > &cloud_in, const std::vector< int, Eigen::aligned_allocator< int > > &indices, pcl::PointCloud< PointT > &cloud_out)
 Extract the indices of a given point cloud as a new point cloud.
template<typename PointInT , typename PointOutT >
void pcl::copyPointCloud (const pcl::PointCloud< PointInT > &cloud_in, const std::vector< int > &indices, pcl::PointCloud< PointOutT > &cloud_out)
 Extract the indices of a given point cloud as a new point cloud.
template<typename PointInT , typename PointOutT >
void pcl::copyPointCloud (const pcl::PointCloud< PointInT > &cloud_in, const std::vector< int, Eigen::aligned_allocator< int > > &indices, pcl::PointCloud< PointOutT > &cloud_out)
 Extract the indices of a given point cloud as a new point cloud.
template<typename PointT >
void pcl::copyPointCloud (const pcl::PointCloud< PointT > &cloud_in, const PointIndices &indices, pcl::PointCloud< PointT > &cloud_out)
 Extract the indices of a given point cloud as a new point cloud.
template<typename PointInT , typename PointOutT >
void pcl::copyPointCloud (const pcl::PointCloud< PointInT > &cloud_in, const PointIndices &indices, pcl::PointCloud< PointOutT > &cloud_out)
 Extract the indices of a given point cloud as a new point cloud.
template<typename PointT >
void pcl::copyPointCloud (const pcl::PointCloud< PointT > &cloud_in, const std::vector< pcl::PointIndices > &indices, pcl::PointCloud< PointT > &cloud_out)
 Extract the indices of a given point cloud as a new point cloud.
template<typename PointInT , typename PointOutT >
void pcl::copyPointCloud (const pcl::PointCloud< PointInT > &cloud_in, const std::vector< pcl::PointIndices > &indices, pcl::PointCloud< PointOutT > &cloud_out)
 Extract the indices of a given point cloud as a new point cloud.
template<typename PointIn1T , typename PointIn2T , typename PointOutT >
void pcl::concatenateFields (const pcl::PointCloud< PointIn1T > &cloud1_in, const pcl::PointCloud< PointIn2T > &cloud2_in, pcl::PointCloud< PointOutT > &cloud_out)
 Concatenate two datasets representing different fields.
PCL_EXPORTS bool pcl::concatenateFields (const sensor_msgs::PointCloud2 &cloud1_in, const sensor_msgs::PointCloud2 &cloud2_in, sensor_msgs::PointCloud2 &cloud_out)
 Concatenate two datasets representing different fields.
PCL_EXPORTS bool pcl::getPointCloudAsEigen (const sensor_msgs::PointCloud2 &in, Eigen::MatrixXf &out)
 Copy the XYZ dimensions of a sensor_msgs::PointCloud2 into Eigen format.
PCL_EXPORTS bool pcl::getEigenAsPointCloud (Eigen::MatrixXf &in, sensor_msgs::PointCloud2 &out)
 Copy the XYZ dimensions from an Eigen MatrixXf into a sensor_msgs::PointCloud2 message.
template<std::size_t N>
void pcl::io::swapByte (char *bytes)
 swap bytes order of a char array of length N
PCL_EXPORTS int pcl::io::saveOBJFile (const std::string &file_name, const pcl::TextureMesh &tex_mesh, unsigned precision=5)
 Saves a TextureMesh in ascii OBJ format.
PCL_EXPORTS int pcl::io::saveOBJFile (const std::string &file_name, const pcl::PolygonMesh &mesh, unsigned precision=5)
 Saves a PolygonMesh in ascii PLY format.
int pcl::io::loadPCDFile (const std::string &file_name, sensor_msgs::PointCloud2 &cloud)
 Load a PCD v.6 file into a templated PointCloud type.
int pcl::io::loadPCDFile (const std::string &file_name, sensor_msgs::PointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation)
 Load any PCD file into a templated PointCloud type.
template<typename PointT >
int pcl::io::loadPCDFile (const std::string &file_name, pcl::PointCloud< PointT > &cloud)
 Load any PCD file into a templated PointCloud type.
int pcl::io::savePCDFile (const std::string &file_name, const sensor_msgs::PointCloud2 &cloud, const Eigen::Vector4f &origin=Eigen::Vector4f::Zero(), const Eigen::Quaternionf &orientation=Eigen::Quaternionf::Identity(), const bool binary_mode=false)
 Save point cloud data to a PCD file containing n-D points.
template<typename PointT >
int pcl::io::savePCDFile (const std::string &file_name, const pcl::PointCloud< PointT > &cloud, bool binary_mode=false)
 Templated version for saving point cloud data to a PCD file containing a specific given cloud format.
template<typename PointT >
int pcl::io::savePCDFileASCII (const std::string &file_name, const pcl::PointCloud< PointT > &cloud)
 Templated version for saving point cloud data to a PCD file containing a specific given cloud format.
template<typename PointT >
int pcl::io::savePCDFileBinary (const std::string &file_name, const pcl::PointCloud< PointT > &cloud)
 Templated version for saving point cloud data to a PCD file containing a specific given cloud format.
template<typename PointT >
int pcl::io::savePCDFile (const std::string &file_name, const pcl::PointCloud< PointT > &cloud, const std::vector< int > &indices, const bool binary_mode=false)
 Templated version for saving point cloud data to a PCD file containing a specific given cloud format.
void pcl::throwPCLIOException (const char *function_name, const char *file_name, unsigned line_number, const char *format,...)
int pcl::io::loadPLYFile (const std::string &file_name, sensor_msgs::PointCloud2 &cloud)
 Load a PLY v.6 file into a templated PointCloud type.
int pcl::io::loadPLYFile (const std::string &file_name, sensor_msgs::PointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation)
 Load any PLY file into a templated PointCloud type.
template<typename PointT >
int pcl::io::loadPLYFile (const std::string &file_name, pcl::PointCloud< PointT > &cloud)
 Load any PLY file into a templated PointCloud type.
int pcl::io::savePLYFile (const std::string &file_name, const sensor_msgs::PointCloud2 &cloud, const Eigen::Vector4f &origin=Eigen::Vector4f::Zero(), const Eigen::Quaternionf &orientation=Eigen::Quaternionf::Identity(), bool binary_mode=false, bool use_camera=true)
 Save point cloud data to a PLY file containing n-D points.
template<typename PointT >
int pcl::io::savePLYFile (const std::string &file_name, const pcl::PointCloud< PointT > &cloud, bool binary_mode=false)
 Templated version for saving point cloud data to a PLY file containing a specific given cloud format.
template<typename PointT >
int pcl::io::savePLYFileASCII (const std::string &file_name, const pcl::PointCloud< PointT > &cloud)
 Templated version for saving point cloud data to a PLY file containing a specific given cloud format.
template<typename PointT >
int pcl::io::savePLYFileBinary (const std::string &file_name, const pcl::PointCloud< PointT > &cloud)
 Templated version for saving point cloud data to a PLY file containing a specific given cloud format.
template<typename PointT >
int pcl::io::savePLYFile (const std::string &file_name, const pcl::PointCloud< PointT > &cloud, const std::vector< int > &indices, bool binary_mode=false)
 Templated version for saving point cloud data to a PLY file containing a specific given cloud format.
PCL_EXPORTS int pcl::io::savePLYFile (const std::string &file_name, const pcl::PolygonMesh &mesh, unsigned precision=5)
 Saves a PolygonMesh in ascii PLY format.
PCL_EXPORTS int pcl::io::saveVTKFile (const std::string &file_name, const pcl::PolygonMesh &triangles, unsigned precision=5)
 Saves a PolygonMesh in ascii VTK format.

Function Documentation

template<typename PointIn1T , typename PointIn2T , typename PointOutT >
void pcl::concatenateFields ( const pcl::PointCloud< PointIn1T > &  cloud1_in,
const pcl::PointCloud< PointIn2T > &  cloud2_in,
pcl::PointCloud< PointOutT > &  cloud_out 
)

Concatenate two datasets representing different fields.

Note:
If the input datasets have overlapping fields (i.e., both contain the same fields), then the data in the second cloud (cloud2_in) will overwrite the data in the first (cloud1_in).
Parameters:
[in]cloud1_inthe first input dataset
[in]cloud2_inthe second input dataset (overwrites the fields of the first dataset for those that are shared)
[out]cloud_outthe resultant output dataset created by the concatenation of all the fields in the input datasets

Definition at line 341 of file io.hpp.

PCL_EXPORTS bool pcl::concatenateFields ( const sensor_msgs::PointCloud2 cloud1_in,
const sensor_msgs::PointCloud2 cloud2_in,
sensor_msgs::PointCloud2 cloud_out 
)

Concatenate two datasets representing different fields.

Note:
If the input datasets have overlapping fields (i.e., both contain the same fields), then the data in the second cloud (cloud2_in) will overwrite the data in the first (cloud1_in).
Parameters:
[in]cloud1_inthe first input dataset
[in]cloud2_inthe second input dataset (overwrites the fields of the first dataset for those that are shared)
[out]cloud_outthe output dataset created by concatenating all the fields in the input datasets

Concatenate two sensor_msgs::PointCloud2.

Parameters:
[in]cloud1the first input point cloud dataset
[in]cloud2the second input point cloud dataset
[out]cloud_outthe resultant output point cloud dataset
Returns:
true if successful, false if failed (e.g., name/number of fields differs)
template<typename PointInT , typename PointOutT >
void pcl::copyPointCloud ( const pcl::PointCloud< PointInT > &  cloud_in,
pcl::PointCloud< PointOutT > &  cloud_out 
)

Copy all the fields from a given point cloud into a new point cloud.

Parameters:
[in]cloud_inthe input point cloud dataset
[out]cloud_outthe resultant output point cloud dataset

Definition at line 85 of file io.hpp.

PCL_EXPORTS void pcl::copyPointCloud ( const sensor_msgs::PointCloud2 cloud_in,
const std::vector< int > &  indices,
sensor_msgs::PointCloud2 cloud_out 
)

Extract the indices of a given point cloud as a new point cloud.

Parameters:
[in]cloud_inthe input point cloud dataset
[in]indicesthe vector of indices representing the points to be copied from cloud_in
[out]cloud_outthe resultant output point cloud dataset
template<typename PointT >
void pcl::copyPointCloud ( const pcl::PointCloud< PointT > &  cloud_in,
const std::vector< int > &  indices,
pcl::PointCloud< PointT > &  cloud_out 
)

Extract the indices of a given point cloud as a new point cloud.

Parameters:
[in]cloud_inthe input point cloud dataset
[in]indicesthe vector of indices representing the points to be copied from cloud_in
[out]cloud_outthe resultant output point cloud dataset

Definition at line 107 of file io.hpp.

template<typename PointT >
void pcl::copyPointCloud ( const pcl::PointCloud< PointT > &  cloud_in,
const std::vector< int, Eigen::aligned_allocator< int > > &  indices,
pcl::PointCloud< PointT > &  cloud_out 
)

Extract the indices of a given point cloud as a new point cloud.

Parameters:
[in]cloud_inthe input point cloud dataset
[in]indicesthe vector of indices representing the points to be copied from cloud_in
[out]cloud_outthe resultant output point cloud dataset

Definition at line 132 of file io.hpp.

template<typename PointInT , typename PointOutT >
void pcl::copyPointCloud ( const pcl::PointCloud< PointInT > &  cloud_in,
const std::vector< int > &  indices,
pcl::PointCloud< PointOutT > &  cloud_out 
)

Extract the indices of a given point cloud as a new point cloud.

Parameters:
[in]cloud_inthe input point cloud dataset
[in]indicesthe vector of indices representing the points to be copied from cloud_in
[out]cloud_outthe resultant output point cloud dataset

Definition at line 158 of file io.hpp.

template<typename PointInT , typename PointOutT >
void pcl::copyPointCloud ( const pcl::PointCloud< PointInT > &  cloud_in,
const std::vector< int, Eigen::aligned_allocator< int > > &  indices,
pcl::PointCloud< PointOutT > &  cloud_out 
)

Extract the indices of a given point cloud as a new point cloud.

Parameters:
[in]cloud_inthe input point cloud dataset
[in]indicesthe vector of indices representing the points to be copied from cloud_in
[out]cloud_outthe resultant output point cloud dataset

Definition at line 185 of file io.hpp.

template<typename PointT >
void pcl::copyPointCloud ( const pcl::PointCloud< PointT > &  cloud_in,
const PointIndices &  indices,
pcl::PointCloud< PointT > &  cloud_out 
)

Extract the indices of a given point cloud as a new point cloud.

Parameters:
[in]cloud_inthe input point cloud dataset
[in]indicesthe PointIndices structure representing the points to be copied from cloud_in
[out]cloud_outthe resultant output point cloud dataset

Definition at line 213 of file io.hpp.

template<typename PointInT , typename PointOutT >
void pcl::copyPointCloud ( const pcl::PointCloud< PointInT > &  cloud_in,
const PointIndices &  indices,
pcl::PointCloud< PointOutT > &  cloud_out 
)

Extract the indices of a given point cloud as a new point cloud.

Parameters:
[in]cloud_inthe input point cloud dataset
[in]indicesthe PointIndices structure representing the points to be copied from cloud_in
[out]cloud_outthe resultant output point cloud dataset

Definition at line 238 of file io.hpp.

template<typename PointT >
void pcl::copyPointCloud ( const pcl::PointCloud< PointT > &  cloud_in,
const std::vector< pcl::PointIndices > &  indices,
pcl::PointCloud< PointT > &  cloud_out 
)

Extract the indices of a given point cloud as a new point cloud.

Parameters:
[in]cloud_inthe input point cloud dataset
[in]indicesthe vector of indices representing the points to be copied from cloud_in
[out]cloud_outthe resultant output point cloud dataset

Definition at line 265 of file io.hpp.

template<typename PointInT , typename PointOutT >
void pcl::copyPointCloud ( const pcl::PointCloud< PointInT > &  cloud_in,
const std::vector< pcl::PointIndices > &  indices,
pcl::PointCloud< PointOutT > &  cloud_out 
)

Extract the indices of a given point cloud as a new point cloud.

Parameters:
[in]cloud_inthe input point cloud dataset
[in]indicesthe vector of indices representing the points to be copied from cloud_in
[out]cloud_outthe resultant output point cloud dataset

Definition at line 302 of file io.hpp.

PCL_EXPORTS bool pcl::getEigenAsPointCloud ( Eigen::MatrixXf &  in,
sensor_msgs::PointCloud2 out 
)

Copy the XYZ dimensions from an Eigen MatrixXf into a sensor_msgs::PointCloud2 message.

Parameters:
[in]inthe Eigen MatrixXf format containing XYZ0 / point
[out]outthe resultant point cloud message
Note:
the method assumes that the PointCloud2 message already has the fields set up properly !
int pcl::getFieldIndex ( const sensor_msgs::PointCloud2 cloud,
const std::string &  field_name 
) [inline]

Get the index of a specified field (i.e., dimension/channel)

Parameters:
[in]cloudthe the point cloud message
[in]field_namethe string defining the field name

Definition at line 58 of file io.h.

template<typename PointT >
int pcl::getFieldIndex ( const pcl::PointCloud< PointT > &  cloud,
const std::string &  field_name,
std::vector< sensor_msgs::PointField > &  fields 
) [inline]

Get the index of a specified field (i.e., dimension/channel)

Parameters:
[in]cloudthe the point cloud message
[in]field_namethe string defining the field name
[out]fieldsa vector to the original PointField vector that the raw PointCloud message contains

Definition at line 47 of file io.hpp.

template<typename PointT >
void pcl::getFields ( const pcl::PointCloud< PointT > &  cloud,
std::vector< sensor_msgs::PointField > &  fields 
) [inline]

Get the list of available fields (i.e., dimension/channel)

Parameters:
[in]cloudthe point cloud message
[out]fieldsa vector to the original PointField vector that the raw PointCloud message contains

Definition at line 62 of file io.hpp.

int pcl::getFieldSize ( const int  datatype) [inline]

Obtains the size of a specific field data type in bytes.

Parameters:
[in]datatypethe field data type (see PointField.h)

Definition at line 111 of file io.h.

template<typename PointT >
std::string pcl::getFieldsList ( const pcl::PointCloud< PointT > &  cloud) [inline]

Get the list of all fields available in a given cloud.

Parameters:
[in]cloudthe the point cloud message

Definition at line 71 of file io.hpp.

std::string pcl::getFieldsList ( const sensor_msgs::PointCloud2 cloud) [inline]

Get the available point cloud fields as a space separated string.

Parameters:
[in]clouda pointer to the PointCloud message

Definition at line 97 of file io.h.

int pcl::getFieldType ( const int  size,
char  type 
) [inline]

Obtains the type of the PointField from a specific size and type.

Parameters:
[in]sizethe size in bytes of the data field
[in]typea char describing the type of the field ('F' = float, 'I' = signed, 'U' = unsigned)

Definition at line 150 of file io.h.

char pcl::getFieldType ( const int  type) [inline]

Obtains the type of the PointField from a specific PointField as a char.

Parameters:
[in]typethe PointField field type

Definition at line 188 of file io.h.

PCL_EXPORTS bool pcl::getPointCloudAsEigen ( const sensor_msgs::PointCloud2 in,
Eigen::MatrixXf &  out 
)

Copy the XYZ dimensions of a sensor_msgs::PointCloud2 into Eigen format.

Parameters:
[in]inthe point cloud message
[out]outthe resultant Eigen MatrixXf format containing XYZ0 / point
int pcl::io::loadPCDFile ( const std::string &  file_name,
sensor_msgs::PointCloud2 cloud 
) [inline]

Load a PCD v.6 file into a templated PointCloud type.

Any PCD files > v.6 will generate a warning as a sensor_msgs/PointCloud2 message cannot hold the sensor origin.

Parameters:
[in]file_namethe name of the file to load
[out]cloudthe resultant templated point cloud

Definition at line 447 of file pcd_io.h.

int pcl::io::loadPCDFile ( const std::string &  file_name,
sensor_msgs::PointCloud2 cloud,
Eigen::Vector4f &  origin,
Eigen::Quaternionf &  orientation 
) [inline]

Load any PCD file into a templated PointCloud type.

Parameters:
[in]file_namethe name of the file to load
[out]cloudthe resultant templated point cloud
[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)

Definition at line 462 of file pcd_io.h.

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

Load any PCD file into a templated PointCloud type.

Parameters:
[in]file_namethe name of the file to load
[out]cloudthe resultant templated point cloud

Definition at line 476 of file pcd_io.h.

int pcl::io::loadPLYFile ( const std::string &  file_name,
sensor_msgs::PointCloud2 cloud 
) [inline]

Load a PLY v.6 file into a templated PointCloud type.

Any PLY files containg sensor data will generate a warning as a sensor_msgs/PointCloud2 message cannot hold the sensor origin.

Parameters:
[in]file_namethe name of the file to load
[in]cloudthe resultant templated point cloud

Definition at line 362 of file ply_io.h.

int pcl::io::loadPLYFile ( const std::string &  file_name,
sensor_msgs::PointCloud2 cloud,
Eigen::Vector4f &  origin,
Eigen::Quaternionf &  orientation 
) [inline]

Load any PLY file into a templated PointCloud type.

Parameters:
[in]file_namethe name of the file to load
[in]cloudthe resultant templated point cloud
[in]originthe sensor acquisition origin (only for > PLY_V7 - null if not present)
[in]orientationthe sensor acquisition orientation if availble, identity if not present

Definition at line 377 of file ply_io.h.

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

Load any PLY file into a templated PointCloud type.

Parameters:
[in]file_namethe name of the file to load
[in]cloudthe resultant templated point cloud

Definition at line 391 of file ply_io.h.

PCL_EXPORTS int pcl::io::saveOBJFile ( const std::string &  file_name,
const pcl::TextureMesh tex_mesh,
unsigned  precision = 5 
)

Saves a TextureMesh in ascii OBJ format.

Parameters:
[in]file_namethe name of the file to write to disk
[in]tex_meshthe texture mesh to save
[in]precisionthe output ASCII precision
PCL_EXPORTS int pcl::io::saveOBJFile ( const std::string &  file_name,
const pcl::PolygonMesh mesh,
unsigned  precision = 5 
)

Saves a PolygonMesh in ascii PLY format.

Parameters:
[in]file_namethe name of the file to write to disk
[in]meshthe polygonal mesh to save
[in]precisionthe output ASCII precision default 5
int pcl::io::savePCDFile ( const std::string &  file_name,
const sensor_msgs::PointCloud2 cloud,
const Eigen::Vector4f &  origin = Eigen::Vector4f::Zero (),
const Eigen::Quaternionf &  orientation = Eigen::Quaternionf::Identity (),
const bool  binary_mode = false 
) [inline]

Save point cloud data to a PCD file containing n-D points.

Parameters:
[in]file_namethe output file name
[in]cloudthe point cloud data message
[in]originthe sensor acquisition origin
[in]orientationthe sensor acquisition orientation
[in]binary_modetrue for binary mode, false (default) for ASCII

Caution: PointCloud structures containing an RGB field have traditionally used packed float values to store RGB data. Storing a float as ASCII can introduce variations to the smallest bits, and thus significantly alter the data. This is a known issue, and the fix involves switching RGB data to be stored as a packed integer in future versions of PCL.

Definition at line 498 of file pcd_io.h.

template<typename PointT >
int pcl::io::savePCDFile ( const std::string &  file_name,
const pcl::PointCloud< PointT > &  cloud,
bool  binary_mode = false 
) [inline]

Templated version for saving point cloud data to a PCD file containing a specific given cloud format.

Parameters:
[in]file_namethe output file name
[in]cloudthe point cloud data message
[in]binary_modetrue for binary mode, false (default) for ASCII

Caution: PointCloud structures containing an RGB field have traditionally used packed float values to store RGB data. Storing a float as ASCII can introduce variations to the smallest bits, and thus significantly alter the data. This is a known issue, and the fix involves switching RGB data to be stored as a packed integer in future versions of PCL.

Definition at line 522 of file pcd_io.h.

template<typename PointT >
int pcl::io::savePCDFile ( const std::string &  file_name,
const pcl::PointCloud< PointT > &  cloud,
const std::vector< int > &  indices,
const bool  binary_mode = false 
)

Templated version for saving point cloud data to a PCD file containing a specific given cloud format.

Parameters:
[in]file_namethe output file name
[in]cloudthe point cloud data message
[in]indicesthe set of indices to save
[in]binary_modetrue for binary mode, false (default) for ASCII

Caution: PointCloud structures containing an RGB field have traditionally used packed float values to store RGB data. Storing a float as ASCII can introduce variations to the smallest bits, and thus significantly alter the data. This is a known issue, and the fix involves switching RGB data to be stored as a packed integer in future versions of PCL.

Definition at line 585 of file pcd_io.h.

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

Templated version for saving point cloud data to a PCD file containing a specific given cloud format.

This version is to retain backwards compatibility.

Parameters:
[in]file_namethe output file name
[in]cloudthe point cloud data message

Caution: PointCloud structures containing an RGB field have traditionally used packed float values to store RGB data. Storing a float as ASCII can introduce variations to the smallest bits, and thus significantly alter the data. This is a known issue, and the fix involves switching RGB data to be stored as a packed integer in future versions of PCL.

Definition at line 545 of file pcd_io.h.

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

Templated version for saving point cloud data to a PCD file containing a specific given cloud format.

This version is to retain backwards compatibility.

Parameters:
[in]file_namethe output file name
[in]cloudthe point cloud data message

Definition at line 561 of file pcd_io.h.

int pcl::io::savePLYFile ( const std::string &  file_name,
const sensor_msgs::PointCloud2 cloud,
const Eigen::Vector4f &  origin = Eigen::Vector4f::Zero (),
const Eigen::Quaternionf &  orientation = Eigen::Quaternionf::Identity (),
bool  binary_mode = false,
bool  use_camera = true 
) [inline]

Save point cloud data to a PLY file containing n-D points.

Parameters:
[in]file_namethe output file name
[in]cloudthe point cloud data message
[in]originthe sensor data acquisition origin (translation)
[in]orientationthe sensor data acquisition origin (rotation)
[in]binary_modetrue for binary mode, false (default) for ASCII

Definition at line 406 of file ply_io.h.

template<typename PointT >
int pcl::io::savePLYFile ( const std::string &  file_name,
const pcl::PointCloud< PointT > &  cloud,
bool  binary_mode = false 
) [inline]

Templated version for saving point cloud data to a PLY file containing a specific given cloud format.

Parameters:
[in]file_namethe output file name
[in]cloudthe point cloud data message
[in]binary_modetrue for binary mode, false (default) for ASCII

Definition at line 423 of file ply_io.h.

template<typename PointT >
int pcl::io::savePLYFile ( const std::string &  file_name,
const pcl::PointCloud< PointT > &  cloud,
const std::vector< int > &  indices,
bool  binary_mode = false 
)

Templated version for saving point cloud data to a PLY file containing a specific given cloud format.

Parameters:
[in]file_namethe output file name
[in]cloudthe point cloud data message
[in]indicesthe set of indices to save
[in]binary_modetrue for binary mode, false (default) for ASCII

Definition at line 462 of file ply_io.h.

PCL_EXPORTS int pcl::io::savePLYFile ( const std::string &  file_name,
const pcl::PolygonMesh mesh,
unsigned  precision = 5 
)

Saves a PolygonMesh in ascii PLY format.

Parameters:
[in]file_namethe name of the file to write to disk
[in]meshthe polygonal mesh to save
[in]precisionthe output ASCII precision default 5
template<typename PointT >
int pcl::io::savePLYFileASCII ( const std::string &  file_name,
const pcl::PointCloud< PointT > &  cloud 
) [inline]

Templated version for saving point cloud data to a PLY file containing a specific given cloud format.

Parameters:
[in]file_namethe output file name
[in]cloudthe point cloud data message

Definition at line 436 of file ply_io.h.

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

Templated version for saving point cloud data to a PLY file containing a specific given cloud format.

Parameters:
[in]file_namethe output file name
[in]cloudthe point cloud data message

Definition at line 448 of file ply_io.h.

PCL_EXPORTS int pcl::io::saveVTKFile ( const std::string &  file_name,
const pcl::PolygonMesh triangles,
unsigned  precision = 5 
)

Saves a PolygonMesh in ascii VTK format.

Parameters:
[in]file_namethe name of the file to write to disk
[in]trianglesthe polygonal mesh to save
[in]precisionthe output ASCII precision
template<std::size_t N>
void pcl::io::swapByte ( char *  bytes)

swap bytes order of a char array of length N

Parameters:
byteschar array to swap
void pcl::throwPCLIOException ( const char *  function_name,
const char *  file_name,
unsigned  line_number,
const char *  format,
  ... 
) [inline]
Parameters:
[in]function_namethe name of the method where the exception was caused
[in]file_namethe name of the file where the exception was caused
[in]line_numberthe number of the line where the exception was caused
[in]formatprintf format

Definition at line 81 of file pcl_io_exception.h.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines