I believe that there is a small flaw in the data_classes.py file in the LidarPointCloud class (PointCloud). Because not all files that I tried to get have the same format for the reshape ((- - 1, 5)) [:,: cls.nbr_dims ()], that is, points = scan.reshape ((- -, 5) ) [:,: cls.nbr_dims ()]. I encountered such a problem in scene 21.
So, I replaced the LidarPointCloud (PointCloud) class with:
class LidarPointCloud(PointCloud):
@staticmethod
def nbr_dims() -> int:
"""Returns the number of dimensions.
Returns: Number of dimensions.
"""
return 4
@classmethod
def from_file(cls, file_name: Path) -> "LidarPointCloud":
"""Loads LIDAR data from binary numpy format. Data is stored as (x, y, z, intensity, ring index).
Args:
file_name: Path of the pointcloud file on disk.
Returns: LidarPointCloud instance (x, y, z, intensity).
"""
assert file_name.suffix == ".bin", "Unsupported filetype {}".format(file_name)
scan = np.fromfile(str(file_name), dtype=np.float32)
if len(scan) % 5 == 0:
points = scan.reshape((-1, 5))[:, : cls.nbr_dims()]
else:
scan0=[]
scan1=[]
scan2=[]
scan3=[]
scan4=[]
scan_pontos = []
scan_pontos = scan.reshape((-1, 1))
dv = 0
for divisao in range(math.floor(len(scan)/5)):
if (dv+4)<=len(scan):
scan0.append(scan_pontos[dv])
scan1.append(scan_pontos[dv+1])
scan2.append(scan_pontos[dv+2])
scan3.append(scan_pontos[dv+3])
scan4.append(scan_pontos[dv+4])
dv = dv+5
points = np.concatenate((scan0,scan1,scan2,scan3),axis=1)
return cls(points.T)
I I believe that now I got the correct point cloud values.
I believe that there is a small flaw in the data_classes.py file in the LidarPointCloud class (PointCloud). Because not all files that I tried to get have the same format for the reshape ((- - 1, 5)) [:,: cls.nbr_dims ()], that is, points = scan.reshape ((- -, 5) ) [:,: cls.nbr_dims ()]. I encountered such a problem in scene 21. So, I replaced the LidarPointCloud (PointCloud) class with:
I I believe that now I got the correct point cloud values.