Point Cloud Export

Experimental API for exporting frames to common 3D file formats with control over color space, layout, and whether to include normals. Resides in Zivid::Experimental::PointCloudExport and may change without prior notice.

        %%{init: {'themeVariables': {'fontSize': '18px'}, 'flowchart': {'nodeSpacing': 30, 'rankSpacing': 35}}}%%
flowchart LR
  Frame
  FileFormat["FileFormat (ZDF/PLY/XYZ/PCD)"]

  exportOp(["exportFrame()"])

  File["file on disk"]

  Frame -.-> exportOp --> File
  FileFormat -.-> exportOp

  classDef zividClass fill:#4A8FA4,stroke:#34323D,color:#FFFFFF
  classDef api fill:#91D2C8,stroke:#4A8FA4,color:#000000
  class Frame,FileFormat,File zividClass
  class exportOp api
    

exportFrame

Exports a Frame to a file on disk. The file format is determined by the second argument: ZDF, PLY, XYZ, or PCD. Each format type carries its own options (color space, normals, etc.).

void Zivid::Experimental::PointCloudExport::exportFrame(const Zivid::Frame &frame, const FileFormat::ZDF &specification)

Save frame to ZDF file.

Saves frame object to a ZDF file.

Parameters:
  • frameFrame object to save

  • specification – Specification for saving frame in ZDF format

void Zivid::Experimental::PointCloudExport::exportFrame(const Zivid::Frame &frame, const FileFormat::PLY &specification)

Save frame to PLY file.

Saves frame object to a PLY file. Specify the layout, color space and whether to include normal data of the point cloud data in specification parameter.

Parameters:
  • frameFrame object to save

  • specification – Specification for saving frame in PLY format

void Zivid::Experimental::PointCloudExport::exportFrame(const Zivid::Frame &frame, const FileFormat::XYZ &specification)

Save frame to XYZ file.

Saves frame object to a XYZ file. XYZ (position) and RGB (color) values are separated with white space. Each new point is separated by the newline character. Specify the color space of the point cloud data in specification parameter.

Parameters:
  • frameFrame object to save

  • specification – Specification for saving frame in XYZ format

void Zivid::Experimental::PointCloudExport::exportFrame(const Zivid::Frame &frame, const FileFormat::PCD &specification)

Save frame to PCD file.

Saves frame object to a PCD file. Specify the layout, color space and whether to include normal data of the point cloud data in specification parameter. When Layout option is not set, exported data is organized but with incorrect header. The correct header can be set in the exported PCD file by setting Configuration/APIBreakingBugFixes/FileFormats/PCD/UseOrganizedFormat in the Config.yml file.

Parameters:
  • frameFrame object to save

  • specification – Specification for saving frame in PCD format

class PointCloudExport

Public Types

enum class ColorSpace

Color space to use when saving frame.

Enum used to specify the color space of the point cloud when saving a frame to a file.

Values:

enumerator SRGB
enumerator LinearRGB
enum class IncludeNormals

Include normals in the exported file.

Enum used to specify if normals should be included when saving a frame to a file.

Values:

enumerator No
enumerator Yes

Public Static Functions

static void ExportFrame (Zivid::NET::Frame ^ frame, FileFormat::ZDF ^ specification)

Save frame to ZDF file.

Saves frame object to a ZDF file.

Parameters:
  • frameFrame object to save

  • specification – Specification for saving frame in ZDF format

static void ExportFrame (Zivid::NET::Frame ^ frame, FileFormat::PLY ^ specification)

Save frame to PLY file.

Saves frame object to a PLY file. Specify the layout, color space and whether to include normal data of the point cloud data in specification parameter.

Parameters:
  • frameFrame object to save

  • specification – Specification for saving frame in PLY format

static void ExportFrame (Zivid::NET::Frame ^ frame, FileFormat::XYZ ^ specification)

Save frame to XYZ file.

Saves frame object to a XYZ file. XYZ (position) and RGB (color) values are separated with white space. Each new point is separated by the newline character. Specify the color space of the point cloud data in specification parameter.

Parameters:
  • frameFrame object to save

  • specification – Specification for saving frame in XYZ format

static void ExportFrame (Zivid::NET::Frame ^ frame, FileFormat::PCD ^ specification)

Save frame to PCD file.

Saves frame object to a PCD file. Specify the layout, color space and whether to include normal data of the point cloud data in specification parameter. When Layout option is not set, exported data is organized but with incorrect header. The correct header can be set in the exported PCD file by setting Configuration/APIBreakingBugFixes/FileFormats/PCD/UseOrganizedFormat in the Config.yml file.

Parameters:
  • frameFrame object to save

  • specification – Specification for saving frame in PCD format

static void ExportUnorganizedPointCloud (Zivid::NET::UnorganizedPointCloud ^ pointCloud, FileFormat::PLY ^ specification)

Save unorganized pointcloud to PLY file.

Saves unorganized point cloud to a PLY file. Specify the color space for RGB data in the specification. The layout in the specification object must be unordered. Cannot include normal data in the exported PLY file from an unorganized point cloud.

Parameters:
  • pointCloud – Unorganized point cloud to save

  • specification – Specification for saving unorganized point cloud in PLY format

static void ExportUnorganizedPointCloud (Zivid::NET::UnorganizedPointCloud ^ pointCloud, FileFormat::XYZ ^ specification)

Save unorganized pointcloud to XYZ file.

Saves unorganized point cloud to a XYZ file. XYZ (position) and RGB (color) values are separated with white space. Each new point is separated by the newline character. Specify the color space of the point cloud data in specification parameter.

Parameters:
  • pointCloud – Unorganized point cloud to save

  • specification – Specification for saving unorganized point cloud in XYZ format

static void ExportUnorganizedPointCloud (Zivid::NET::UnorganizedPointCloud ^ pointCloud, FileFormat::PCD ^ specification)

Save unorganized pointcloud to PCD file.

Saves unorganized point cloud to a PCD file. Specify the color space for RGB data in the specification. The layout in the specification object must be unorganized. Cannot include normal data in the exported PCD file from an unorganized point cloud.

Parameters:
  • pointCloud – Unorganized point cloud to save

  • specification – Specification for saving unorganized point cloud in PCD format

class FileFormat
class PCD

Specification for saving frame in PCD (*.pcd) format.

PCD is a file format native to the Point Cloud Library (PCL). To learn more about the PCD file format, see https://pcl.readthedocs.io/projects/tutorials/en/latest/pcd_file_format.html#pcd-file-format.

Public Types

enum class Layout

Layout for saving point cloud.

When Layout option is not set, the exported PCD file will follow the format based on configuration option, Configuration/APIBreakingBugFixes/FileFormats/PCD/UseOrganizedFormat in the Config.yml file.

Values:

enumerator Organized
enumerator Unorganized

Public Functions

PCD (System::String ^ fileName)

Create PCD specification with file name.

Sets color space to sRGB.

Parameters:

fileName – File name

PCD (System::String ^ fileName, ColorSpace colorSpace)

Create PCD specification with file name and color space.

Does not save normal data in the PCD file.

Parameters:
  • fileName – File name

  • colorSpace – Color space

PCD (System::String ^ fileName, ColorSpace colorSpace, IncludeNormals includeNormals)

Create PCD specification with file name, color space and normals.

Parameters:
  • fileName – File name

  • colorSpace – Color space

  • includeNormals – Include normals

PCD (System::String ^ fileName, ColorSpace colorSpace, IncludeNormals includeNormals, Layout layout)

Create PCD specification with file name, color space, normals and layout.

Parameters:
  • fileName – File name

  • colorSpace – Color space

  • includeNormals – Include normals

  • layout – Layout

System::String ^ ToString () override

Get string representation of PCD specification.

class PLY

Specification for saving frame in PLY (*.ply) format.

PLY is a file format developed at Stanford. To learn more about the PLY file format, see https://paulbourke.net/dataformats/ply/.

Public Types

enum class Layout

Layout for saving point cloud.

Values:

enumerator Ordered
enumerator Unordered

Public Functions

PLY (System::String ^ fileName)

Create PLY specification with file name.

Sets layout to Ordered and color space to sRGB.

Parameters:

fileName – File name

PLY (System::String ^ fileName, Layout layout, ColorSpace colorSpace)

Create PLY specification with file name, layout, and color space.

Does not save normal data in the PLY file.

Parameters:
  • fileName – File name

  • layout – Layout

  • colorSpace – Color space

PLY (System::String ^ fileName, Layout layout, ColorSpace colorSpace, IncludeNormals includeNormals)

Create PLY specification with file name, layout, color space and normals.

Parameters:
  • fileName – File name

  • layout – Layout

  • colorSpace – Color space

  • includeNormals – Include normals

System::String ^ ToString () override

Get string representation of ZDF specification.

class XYZ

Specification for saving frame in ASCII (*.xyz) format.

ASCII characters are used to store cartesian coordinates of XYZ points and RGB color values.

Public Functions

XYZ (System::String ^ fileName)

Create XYZ specification with file name.

Sets color space to sRGB.

Parameters:

fileName – File name

XYZ (System::String ^ fileName, ColorSpace colorSpace)

Create XYZ specification with file name and color space.

Parameters:
  • fileName – File name

  • colorSpace – Color space

System::String ^ ToString () override

Get string representation of XYZ specification.

class ZDF

Specification for saving frame in ZDF (*.zdf) format.

ZDF is the native Zivid file format.

Public Functions

ZDF (System::String ^ fileName)

Create ZDF specification with file name.

Parameters:

fileName – File name

System::String ^ ToString () override

Get string representation of ZDF specification.

See also