pcwrite - Write 3-D point cloud to PLY or PCD file - MATLAB (original) (raw)
Write 3-D point cloud to PLY or PCD file
Syntax
Description
pcwrite([ptCloud](#buph6m1-1-ptCloud),[filename](#buph6m1-1-filename))
writes the point cloud object, ptCloud
, to the PLY or PCD file specified by the input filename
.
pcwrite([ptCloud](#buph6m1-1-ptCloud),[filename](#buph6m1-1-filename),Encoding=[encodingType](#buph6m1-1-encodingType))
writes a pointCloud object,ptCloud
, to a PLY file that is in the specified format.
Examples
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
File name, specified as a character vector or string scalar. 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. All NaN
or Inf
values will be skipped when writing to a PLY file.
Object for storing point cloud, specified as a pointCloud object.
PLY or PCD formatted file, specified as "ascii"
,"binary"
, or "compressed"
for the file format.
File Format | Valid Encodings |
---|---|
PLY | "ascii","binary" |
PCD | "ascii","binary", or"compressed" NoteThe PCD file format does not support storing colors of datatype uint16. You can downsize the color to uint8 to save the file in a PCD format or save it in the PLY format. |
To improve performance when writing large point clouds, use the"compressed"
or "binary"
file type.
Version History
Introduced in R2015a