Matlab点云ply文件的读入与写出

%% read in
%1
tic
p1=dlmread('3D.txt');
toc %1.3s

%2
tic
p2=importdata('3D.txt');
toc %1.2s

%3 PLY file
tic
p3=pcread('p1_bi.ply');
toc %1.2s
%% write out
%1 
tic
dlmwrite('p1.txt',p1);
toc %22s
%2
tic;fid = fopen('p2.txt','w');
for i=1:size(p1,1)
    fprintf(fid,'%f %f %f  \r\n',[p1(i,1),p1(i,2),p1(i,3)]);   
end
fclose(fid);
toc %18s
%3 pcwrite PCD or PLY
ptCloud = pointCloud(p1);
tic
pcwrite(ptCloud,'p1_bi.ply','PLYFormat','binary');
toc %0.2s
tic
pcwrite(ptCloud,'p1_as.ply','PLYFormat','ascii');
toc %2s

%% show 3d point 
figure;pcshow(ptCloud);
figure;pcshow(p1);


发布了179 篇原创文章 · 获赞 124 · 访问量 70万+

猜你喜欢

转载自blog.csdn.net/shixin_0125/article/details/105175779
今日推荐