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

2 visualizaciones (últimos 30 días)
Sushmitha Kudari
Sushmitha Kudari el 22 de Feb. de 2020
Comentada: Sushmitha Kudari el 22 de Feb. de 2020
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 comentario
Sushmitha Kudari
Sushmitha Kudari el 22 de Feb. de 2020
Found the issue: if you are not passing in a color matrix, you should not include the color properties in the header.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Point Cloud Processing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by