资源简介

基于matlab平台上的深度图.png传换成三维点云数据,并存储为ply文件,简洁易懂,需要已知深度内参:fx,fy,cx,cy

资源截图

代码片段和文件信息

function build_ply(outfilexyzrgb)
%outfile is the binary ply‘filename which you want to make;
%xyz is the N*3 matrix for point cloud‘s coordinate data;
%rgb is the color for every point respectively.
if(size(xyz1)~=size(rgb1))
    error(‘Input xyz and rgb arguments should have same number of rows‘);
end
if(size(xyz2)~=3 | size(rgb2)~=3)
    error(‘Input xyz aand rgb arguments should have 3 columns‘);
end


pt3d(:1) = xyz(:1);
pt3d(:2) = xyz(:2);
pt3d(:3) = xyz(:3);
pt3d=pt3d‘;
RGB(:1) = uint8(rgb(:1));
RGB(:2) = uint8(rgb(:2));
RGB(:3) = uint8(rgb(:3));
RGB=RGB‘;
dataChunk = [reshape(typecast(reshape(single(pt3d)1[])‘uint8‘)3*4[]); RGB];
size(dataChunk2)
file = writePLYhead(outfile size(dataChunk2));
fwrite(file dataChunk‘uint8‘);
fclose(file);
end

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-12-22 15:52  DepthtoCloud\
     文件         813  2018-07-20 14:04  DepthtoCloud\build_ply.m
     文件       60148  2018-12-10 11:58  DepthtoCloud\depth.png
     文件         529  2018-12-22 15:05  DepthtoCloud\DepthtoCloud.asv
     文件         503  2018-12-22 15:52  DepthtoCloud\DepthtoCloud.m
     文件          69  2018-12-22 15:49  DepthtoCloud\intrinsics.txt
     文件         733  2018-06-27 16:11  DepthtoCloud\writePLYhead.m

评论

共有 条评论