The PlyCloud IO library furnishes a C++ template-based framework for exporting point cloud data to PLY files, compatible with both ASCII and binary formats. It encompasses functionalities to delineate point types replete with diverse attributes (e.g., position, color, normal), spontaneously generate PLY headers, and transmit point datasets to output streams.
- Template Specialization: Leverages C++ templates to autonomously generate code tailored for inscribing varied property types into PLY files.
- Flexible Point Types: Backs the definition of bespoke point structures imbued with properties akin to
float
,double
,int8_t
, etc., and enrolls them for automated management in the course of PLY file genesis. - Macro-Based Registration: Proffers macros (
REGISTER_PLY_WRITE_POINT
) to streamline the enrollment of nascent point types alongside their attributes. - Stream Writing: Employs
PlyPointStreamWriter
andPlyPointFileStreamWriter
classes to expedite the transcription of point clouds to either conventional or file-based streams efficiently. - Binary & ASCII Support: Facilitates the election between binary (streamlined for compactness and velocity) and ASCII (human-legible) formats for PLY yield.
- Header Management: Dynamically curates the PLY header segment, refreshing it in consonance with point inscription, thereby ascertaining the precise enumeration of vertices is chronicled.
Craft a structure inheriting from PlyPointXYZ
(or explicates properties outright) encompassing the yearned fields (e.g., position, color, intensity, normals).
Employ the dispensed macros to enroll your point prototype along with its characteristics. A model:
struct MyPointType {
float x, y, z;
uint8_t r, g, b;
};
REGISTER_PLY_WRITE_POINT(MyPointType, (float, x, x)(float, y, y)(float, z, z)(uint8_t, r, r)(uint8_t, g, g)(uint8_t, b, b))
Instantiate a PlyPointFileStreamWriter
or PlyPointStreamWriter
, utilizing your point archetype, and commence penning points to the conduit.
REGISTER_PLY_WRITE_POINT
: Registers a point prototype inclusive of its attributes for PLY documentation.PLY_REGIST_WRITE_HEAD
andPLY_REGIST_WRITE_POINT
: Intrinsic macros for enrolling header and point inscription rationale.PLY_WRITE_PROPERTY
andPLY_WRITER_POINT
: Auxiliary macros facilitating property delineations and point inscriptions individually.
PlyPropertyTraits
: A template class for scripting property categories to an emission conduit.PlyWriteHeadTraits
andPlyWritePointTraits
: Templates delineating the methodology of scripting the PLY header and discrete points of a specified category.PlyPointStreamWriter
: Scripts points to any output conduit.PlyPointFileStreamWriter
: A specialized scribe for file conduits, augmented with supplementary file governance capabilities.
Requires Boost Preprocessor for macro processing.
Incorporate PLYCLOUD_IO_HPP
into your project and adhere to the directives outlined in the Usage section to embark on documenting point clouds as PLY files.
The library is architectured for facile extension to accommodate custom point prototypes and supplementary attribute administration. Simply delineate your proprietary point structures and harness the registration macros accordingly.
For a holistic illustration, refer to the dispensed structure definitions, such as PlyPointXYZRGB
, and their enrollment and utilization within the library's source code.
The code excerpt provided encompasses a comprehensive anthology of predefined point prototypes (e.g., PlyPointXYZRGB
, PlyPointXYZN
) with exemplars of their registration and usage. Tailor or augment these in accordance with your application's requirements.