According to the official documentation, numpy.fromfile assumes platform-dependent binary format, and hence, it should not be used to transfer data from machines with different architectures.
def load_velo_scan(file):
"""Load and parse a velodyne binary file."""
scan = np.fromfile(file, dtype=np.float32)
return scan.reshape((-1, 4))
I am concerned about using the function to load data from the velodyne bin files provided by KITTI. Is this approach guaranteed to work regardless of the CPU architecture on which the code is being run?
I'm not sure how np.fromfile() works on big-endian machines, but I agree, it would not hurt to use dtype='<f4' to set the data type explicitly to little-endian single-precision float.
According to the official documentation,
numpy.fromfile
assumes platform-dependent binary format, and hence, it should not be used to transfer data from machines with different architectures.The
load_velo_scan
is currently defined as:I am concerned about using the function to load data from the velodyne bin files provided by KITTI. Is this approach guaranteed to work regardless of the CPU architecture on which the code is being run?