PCREAD: Not all points defined in the header could be loaded.

5 次查看(过去 30 天)
I have the following function to export data into .ply format. However when I use
ptCloud = pcread('OutputFile.ply')
it looks like all the properties of ptCloud is empty.
Data File: Data File
Code to Export as .ply:
function write_ply(fname, P) %C
% Input: fname: output file name, e.g. 'data.ply'
% P: 3*m matrix with the rows indicating X, Y, Z
% C: 3*m matrix with the rows indicating R, G, B
num = size(P, 2);
header = 'ply\n';
header = [header, 'format ascii 1.0\n'];
header = [header, 'comment written by Sush\n'];
header = [header, 'element vertex ', num2str(num), '\n'];
header = [header, 'property float32 x\n'];
header = [header, 'property float32 y\n'];
header = [header, 'property float32 z\n'];
header = [header, 'property uchar red\n'];
header = [header, 'property uchar green\n'];
header = [header, 'property uchar blue\n'];
header = [header, 'end_header\n'];
data = [P'];
%, double(C')];
fid = fopen(fname, 'w');
fprintf(fid, header);
dlmwrite(fname, data, '-append', 'delimiter', '\t', 'precision', 3);
fclose(fid);
  1 个评论
Sushmitha Kudari
Sushmitha Kudari 2020-2-22
Found the issue: if you are not passing in a color matrix, you should not include the color properties in the header.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Point Cloud Processing 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by