I have a LiDAR data set that is in 32 bytes binary big endian format and I need to convert it to python list or array then convert it to a PCD file. I'm currently using the following code, but it is only for 16 byte.
What modification should I make to let the code work for 32 byte big endian file? This is a link to the file that I'm working with.
import open3d as o3d
import numpy as np
import os
import sys
import struct
size_float = 4
list_pcd = []
with open ("C:\\Users\\wilso\\python\\datasets\\DOTX182013031901004142612.log", "rb") as f:
byte = f.read(size_float*4)
while byte:
x,y,z,intensity = struct.unpack("ffff", byte)
list_pcd.append([x, y, z])
byte = f.read(size_float*4)
np_pcd = np.asarray(list_pcd)
pcd = o3d.geometry.PointCloud()
v3d = o3d.utility.Vector3dVector
pcd.points = v3d(np_pcd)
o3d.io.write_point_cloud("copy_of_fragment.pcd", pcd)