Point Cloud Library (PCL)  1.14.1-dev
List of all members | Public Types | Public Member Functions
pcl::PLYReader Class Reference

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

#include <pcl/io/ply_io.h>

+ Inheritance diagram for pcl::PLYReader:
+ Collaboration diagram for pcl::PLYReader:

Public Types

enum  { PLY_V0 = 0 , PLY_V1 = 1 }
 

Public Member Functions

 PLYReader ()
 
 PLYReader (const PLYReader &p)
 
PLYReaderoperator= (const PLYReader &p)
 
 ~PLYReader () override
 
int readHeader (const std::string &file_name, pcl::PCLPointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &ply_version, int &data_type, unsigned int &data_idx, const int offset=0) override
 Read a point cloud data header from a PLY file. More...
 
int read (const std::string &file_name, pcl::PCLPointCloud2 &cloud, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &ply_version, const int offset=0) override
 Read a point cloud data from a PLY 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 PLY file 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 PLY file, and convert it to the given template format. More...
 
int read (const std::string &file_name, pcl::PolygonMesh &mesh, Eigen::Vector4f &origin, Eigen::Quaternionf &orientation, int &ply_version, const int offset=0)
 Read a point cloud data from a PLY file and store it into a pcl/PolygonMesh. More...
 
int read (const std::string &file_name, pcl::PolygonMesh &mesh, const int offset=0)
 Read a point cloud data from a PLY file and store it into a pcl/PolygonMesh. 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...
 

Detailed Description

Point Cloud Data (PLY) file format reader.

The PLY data format is organized in the following way: lines beginning with "comment" are treated as comments

Author
Nizar Sallem

Definition at line 80 of file ply_io.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
PLY_V0 
PLY_V1 

Definition at line 83 of file ply_io.h.

Constructor & Destructor Documentation

◆ PLYReader() [1/2]

pcl::PLYReader::PLYReader ( )
inline

Definition at line 89 of file ply_io.h.

◆ PLYReader() [2/2]

pcl::PLYReader::PLYReader ( const PLYReader p)
inline

Definition at line 94 of file ply_io.h.

◆ ~PLYReader()

pcl::PLYReader::~PLYReader ( )
inlineoverride

Definition at line 111 of file ply_io.h.

Member Function Documentation

◆ operator=()

PLYReader& pcl::PLYReader::operator= ( const PLYReader p)
inline

Definition at line 102 of file ply_io.h.

◆ read() [1/5]

int pcl::PLYReader::read ( const std::string &  file_name,
pcl::PCLPointCloud2 cloud,
const int  offset = 0 
)
inline

Read a point cloud data from a PLY file and store it into a pcl/PCLPointCloud2.

Note
This function is provided for backwards compatibility only
Parameters
[in]file_namethe name of the file containing the actual PointCloud data
[out]cloudthe resultant PointCloud message read from disk
[in]offsetthe offset in the file where to expect the true header to begin. One usage example for setting the offset parameter is for reading data from a TAR "archive containing multiple 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 166 of file ply_io.h.

References pcl::read().

◆ read() [2/5]

int pcl::PLYReader::read ( const std::string &  file_name,
pcl::PCLPointCloud2 cloud,
Eigen::Vector4f &  origin,
Eigen::Quaternionf &  orientation,
int &  ply_version,
const int  offset = 0 
)
overridevirtual

Read a point cloud data from a PLY file and store it into a pcl/PCLPointCloud2.

Parameters
[in]file_namethe name of the file containing the actual PointCloud data
[out]cloudthe resultant PointCloud message read from disk
[out]originthe sensor data acquisition origin (translation)
[out]orientationthe sensor data acquisition origin (rotation)
[out]ply_versionthe PLY version read from the file
[in]offsetthe offset in the file where to expect the true header to begin. One usage example for setting the offset parameter is for reading data from a TAR "archive containing multiple 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::io::loadPLYFile().

◆ read() [3/5]

template<typename PointT >
int pcl::PLYReader::read ( const std::string &  file_name,
pcl::PointCloud< PointT > &  cloud,
const int  offset = 0 
)
inline

Read a point cloud data from any PLY 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
[in]offsetthe offset in the file where to expect the true header to begin. One usage example for setting the offset parameter is for reading data from a TAR "archive containing multiple 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 184 of file ply_io.h.

References pcl::fromPCLPointCloud2(), pcl::read(), pcl::PointCloud< PointT >::sensor_orientation_, and pcl::PointCloud< PointT >::sensor_origin_.

◆ read() [4/5]

int pcl::PLYReader::read ( const std::string &  file_name,
pcl::PolygonMesh mesh,
const int  offset = 0 
)

Read a point cloud data from a PLY file and store it into a pcl/PolygonMesh.

Parameters
[in]file_namethe name of the file containing the actual PointCloud data
[out]meshthe resultant PolygonMesh message read from disk
[in]offsetthe offset in the file where to expect the true header to begin. One usage example for setting the offset parameter is for reading data from a TAR "archive containing multiple 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).

◆ read() [5/5]

int pcl::PLYReader::read ( const std::string &  file_name,
pcl::PolygonMesh mesh,
Eigen::Vector4f &  origin,
Eigen::Quaternionf &  orientation,
int &  ply_version,
const int  offset = 0 
)

Read a point cloud data from a PLY file and store it into a pcl/PolygonMesh.

Parameters
[in]file_namethe name of the file containing the actual PointCloud data
[out]meshthe resultant PolygonMesh message read from disk
[out]originthe sensor data acquisition origin (translation)
[out]orientationthe sensor data acquisition origin (rotation)
[out]ply_versionthe PLY version read from the file
[in]offsetthe offset in the file where to expect the true header to begin. One usage example for setting the offset parameter is for reading data from a TAR "archive containing multiple 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).

◆ readHeader()

int pcl::PLYReader::readHeader ( const std::string &  file_name,
pcl::PCLPointCloud2 cloud,
Eigen::Vector4f &  origin,
Eigen::Quaternionf &  orientation,
int &  ply_version,
int &  data_type,
unsigned int &  data_idx,
const int  offset = 0 
)
overridevirtual

Read a point cloud data header from a PLY file.

Load only the meta information (number of points, their types, etc), and not the points themselves, from a given PLY 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 data acquisition origin (translation)
    [out]orientationthe sensor data acquisition origin (rotation)
    [out]ply_versionthe PLY version read from the file
    [out]data_typethe type of PLY data stored in the file
    [out]data_idxthe data index
    [in]offsetthe offset in the file where to expect the true header to begin. One usage example for setting the offset parameter is for reading data from a TAR "archive containing multiple 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.


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