Skip to content

Commit

Permalink
Bugfix: avoid failing when colors exists in cloud data (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
nachovizzo authored Jan 23, 2024
1 parent 35b7d7a commit 78e0120
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/lidar_visualizer/datasets/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ def read_kitti_scan(file):

def read_scan_with_intensities(file):
scan = self.o3d.t.io.read_point_cloud(file)
intensity = scan.point.intensity.numpy()
intensity = intensity / intensity.max()
scan.point.colors = self.cmap(intensity)[:, :, :3].reshape(-1, 3)
try:
_ = hasattr(scan.point, "colors")
except KeyError:
intensity = scan.point.intensity.numpy()
intensity = intensity / intensity.max()
scan.point.colors = self.cmap(intensity)[:, :, :3].reshape(-1, 3)
return scan.to_legacy()

return read_scan_with_intensities
Expand Down

0 comments on commit 78e0120

Please sign in to comment.