我的任务是从二进制小端 .ply 文件读取顶点数据。问题是我无法找到一种从 end_header 行之后开始正确提取数据的方法。
PLY 文件:
ply
format binary_little_endian 1.0
element vertex 240753
property float x
property float y
property float z
property float nx
property float ny
property float nz
element face 477808
end_header
(after the end header there is a A0 byte indicating the new line then, ...)
AC76A0C04301644163416a42 ...
我什至无法正确识别第一个浮动。如果我使用浮点数的 IEE754 表示形式转换前 4 个字节,结果为 -3.5047936775001176e-12,但是前四个字节(= 第一个顶点的第一个 x 坐标)应为 -5.01449(根据从二进制到 ascii ply 文件的 meshlab 转换) )。
我正在使用 c++ fread、fseek...
我尝试每 4 个字节交换一次字节序,但结果也很糟糕。
我认为我以错误的方式提取字节。
My task is to read vertex data from a binary little endian .ply file. Problem is that I cant find a way how to correctly extract data, starting after the end_header line.
PLY file:
ply
format binary_little_endian 1.0
element vertex 240753
property float x
property float y
property float z
property float nx
property float ny
property float nz
element face 477808
end_header
(after the end header there is a A0 byte indicating the new line then, ...)
AC76A0C04301644163416a42 ...
I cant properly identify even first float. If I convert first 4 bytes using IEE754 representation of float, the result is -3.5047936775001176e-12, however first four bytes (= the first x coordinate of first vertex) should be -5.01449 (according to meshlab conversion from binary to ascii ply file).
I'm using c++ fread, fseek, ...
I tried to endian swap every 4 bytes but the result is also bad.
I think that I'm extracting the bytes in a wrong manner.
发布评论
评论(1)
正如@tinman 所描述的:
As described by @tinman: