读取Cesium 3DTIle 点云Pnts格式

最近在研究Cesium的3D Tile,要展示点云,所以研究了一下Pnts文件的格式,用Matlab读取了一下文件内容,文件格式参见:https://github.com/CesiumGS/3d-tiles/blob/master/specification/TileFormats/PointCloud/README.md#batched-points

用Matlab读取的,Python等也行,略显麻烦,我只是要看一下内容就行了,不需要构建类,简单就好

fid=fopen('344.pnts','rb');
magic=fread(fid,[1,4],'*char');
version=fread(fid,[1,1],'int32');
byteLength=fread(fid,[1,1],'int32');
featureTableJSONByteLength=fread(fid,[1,1],'int32');
featureTableBinaryByteLength=fread(fid,[1,1],'int32');
batchTableJSONByteLength=fread(fid,[1,1],'int32');
batchTableBinaryByteLength=fread(fid,[1,1],'int32');
freatureTableJSON=fread(fid,[1,featureTableJSONByteLength],'*char');
%{"BATCH_ID":{"byteOffset":125100,"componentType":"UNSIGNED_INT"},"BATCH_LENGTH":8340,"POINTS_LENGTH":8340,"
%POSITION":{"byteOffset":0},"RGB":{"byteOffset":100080}}   
POINTS_LENGTH=2928;
position=fread(fid,[1,POINTS_LENGTH*3],'float32');
RGB=fread(fid,[1,POINTS_LENGTH*3],'uint8');
batch_id=fread(fid,[1,POINTS_LENGTH],'uint32');
batchTableJSON=fread(fid,[1,batchTableJSONByteLength],'*char');

 

你可能感兴趣的:(Cesium,Matlab)