Class PLYIO

Inheritance Relationships

Base Type

Class Documentation

class PLYIO : public lvr2::ModelIOBase

A class for input and output to ply files.

The PLYIO class provides functionalities for reading and writing the Polygon File Format, also known as Stanford Triangle

Format. Both binary and ascii modes are supported. For the actual file handling the RPly library is used.

The following list is a short description of all handled elements and properties of ply files. In short the elements

vertex and face specifies a mesh and the element point specifies a pointcloud. However there is one exception to this: If neither point nor face is defined, it is assumed that the read vertices are meant to be points and thus are loaded as pointcloud.
ELEMENT vertex
   PROPERTY              x (float)
   PROPERTY              y (float)
   PROPERTY              z (float)
   PROPERTY            red (unsigned char)
   PROPERTY          green (unsigned char)
   PROPERTY           blue (unsigned char)
   PROPERTY             nx (float)
   PROPERTY             ny (float)
   PROPERTY             nz (float)
   PROPERTY      intensity (float)
   PROPERTY     confidence (float)
   PROPERTY       x_coords (short)  <<  [only read]
   PROPERTY       y_coords (short)  <<  [only read]
ELEMENT point
   PROPERTY              x (float)
   PROPERTY              y (float)
   PROPERTY              z (float)
   PROPERTY            red (unsigned char)
   PROPERTY          green (unsigned char)
   PROPERTY           blue (unsigned char)
   PROPERTY             nx (float)
   PROPERTY             ny (float)
   PROPERTY             nz (float)
   PROPERTY      intensity (float)
   PROPERTY     confidence (float)
   PROPERTY       x_coords (short)  <<  [only read]
   PROPERTY       y_coords (short)  <<  [only read]
ELEMENT face
   PROPERTY vertex_indices (LIST uchar int)
   PROPERTY   vertex_index (LIST uchar int)  <<  [only read]

Public Functions

inline PLYIO()

Constructor.

inline ~PLYIO()
void save(string filename)

Save PLY with previously specified data.

Save a PLY file with given filename. The mode is automatically set to little endian binary.

Parameters:

filename – Filename of the output file.

inline void save(ModelPtr model, string filename)
ModelPtr read(string filename, bool readColor, bool readConfidence = true, bool readIntensity = true, bool readNormals = true, bool readFaces = true, bool readPanoramaCoords = true)

Read specified PLY file.

Read a specified PLY file. The additional parameters specify the data to be read. The default is to read all available data.

Parameters:
  • filename – Filename of file to read.

  • readColor – Specifies if color should be read.

  • readConfidence – Specifies if confidence should be read.

  • readIntensity – Specifies if intensity should be read.

  • readNormals – Specifies if normals should be read.

  • readFaces – Specifies if faces should be read.

  • readPanoramaCoords – Specifies if panorama coordinates should be read.

ModelPtr read(string filename)

Read specified PLY file.

Read a specified PLY file with all available data.

Parameters:

filename – Filename of file to read.