Skip to content

Commit 836e903

Browse files
committed
feat: add support of rendering segmentation pointcloud
Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
1 parent 8fc13a6 commit 836e903

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

t4_devkit/viewer/viewer.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from t4_devkit.common.converter import to_quaternion
1111
from t4_devkit.common.timestamp import microseconds2seconds
12+
from t4_devkit.dataclass import SegmentationPointCloud
1213
from t4_devkit.lanelet import LaneletParser
1314
from t4_devkit.schema import SensorModality
1415

@@ -426,11 +427,17 @@ def render_pointcloud(
426427
# TODO(ktro2828): add support of rendering pointcloud on images
427428
rr.set_time_seconds(self.config.timeline, seconds)
428429

429-
colors = pointcloud_color(pointcloud, color_mode=color_mode)
430-
rr.log(
431-
format_entity(self.config.ego_entity, channel),
432-
rr.Points3D(pointcloud.points[:3].T, colors=colors),
433-
)
430+
if isinstance(pointcloud, SegmentationPointCloud):
431+
rr.log(
432+
format_entity(self.config.ego_entity, channel),
433+
rr.Points3D(pointcloud.points[:3].T, class_ids=pointcloud.labels),
434+
)
435+
else:
436+
colors = pointcloud_color(pointcloud, color_mode=color_mode)
437+
rr.log(
438+
format_entity(self.config.ego_entity, channel),
439+
rr.Points3D(pointcloud.points[:3].T, colors=colors),
440+
)
434441

435442
@_check_spatial3d
436443
def render_lidarseg(

0 commit comments

Comments
 (0)