Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

pcwrite

Write 3-D point cloud to PLY or PCD file

Syntax

pcwrite(ptCloud,filename)
pcwrite(ptCloud,filename,'Encoding',encodingType)

Description

example

pcwrite(ptCloud,filename) writes the point cloud object, ptCloud, to the PLY or PCD file specified by the input filename character vector.

pcwrite(ptCloud,filename,'Encoding',encodingType) writes a pointCloud object, ptCloud, to a PLY file that is in the specified format.

Examples

collapse all

ptCloud = pcread('teapot.ply');
pcshow(ptCloud); 

pcwrite(ptCloud,'teapotOut','PLYFormat','binary');
load('object3d.mat');
pcwrite(ptCloud,'object3d.pcd','Encoding','ascii');
pc = pcread('object3d.pcd');
pcshow(pc);

Input Arguments

collapse all

File name, specified as a character vector. The input file type must be a PLY or PCD format file.

For a PLY-file, the pcwrite function converts an organized M-by-N-by-3 point cloud to an unorganized M-by-3 format. It converts the format because PLY files do not support organized point clouds. To preserve the organized format, you can save the point cloud as a PCD-file.

If you do not specify the file name with an extension, the function writes the file in a PLY-format.

Object for storing point cloud, specified as a pointCloud object.

PLY or PCD formatted file, specified as the comma-separated pair consisting of the character vector 'Encoding', and a character vector for the file format.

File FormatValid Encodings
PLY'ascii', 'binary'
PCD'ascii', 'binary', or 'compressed'

Introduced in R2015a