Skip to content

Commit

Permalink
Nacho/fix clouds withouth intensity (#14)
Browse files Browse the repository at this point in the history
* Fix visualizer failing when there was no colors or intensity

* Godd attempt but didn't work
  • Loading branch information
nachovizzo authored May 8, 2024
1 parent 482ca7a commit 3884578
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/lidar_visualizer/datasets/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,16 @@ def read_kitti_scan(file):

def read_scan_with_intensities(file):
scan = self.o3d.t.io.read_point_cloud(file)
try:
_ = hasattr(scan.point, "colors")
except KeyError:

if "colors" in dir(scan.point):
return scan.to_legacy()

if "intensity" in dir(scan.point):
intensity = scan.point.intensity.numpy()
intensity = intensity / intensity.max()
scan.point.colors = self.cmap(intensity)[:, :, :3].reshape(-1, 3)

# else
return scan.to_legacy()

return read_scan_with_intensities
Expand Down

0 comments on commit 3884578

Please sign in to comment.