Viewer
Tier4Viewer
Tier4Viewer(app_id: str, cameras: Sequence[str] | None = None, *, without_3d: bool = False, spawn: bool = True)
A viewer class that renders some components powered by rerun.
Construct a new object.
Parameters:
-
app_id
(str
) –Application ID.
-
cameras
(Sequence[str] | None
, default:None
) –Sequence of camera names. If
None
, any 2D spaces will not be visualized. -
without_3d
(bool
, default:False
) –Whether to render objects without the 3D space.
-
spawn
(bool
, default:True
) –Whether to spawn the viewer.
Examples:
>>> from t4_devkit.viewer import Tier4Viewer
# Rendering both 3D/2D spaces
>>> viewer = Tier4Viewer("myapp", cameras=["camera0", "camera1"])
# Rendering 3D space only
>>> viewer = Tier4Viewer("myapp")
# Rendering 2D space only
>>> viewer = Tier4Viewer("myapp", cameras=["camera0", "camera1"], without_3d=True)
with_labels
save
Save recording result as save_dir/{app_id}.rrd
.
Parameters:
-
save_dir
(str
) –Directory path to save the result.
render_box3ds
Render 3D boxes.
Parameters:
-
seconds
(float
) –Timestamp in [sec].
-
boxes
(Sequence[Box3D]
) –Sequence of
Box3D
s.
render_box2ds
Render 2D boxes.
Parameters:
-
seconds
(float
) –Timestamp in [sec].
-
boxes
(Sequence[Box2D]
) –Sequence of
Box2D
s.
render_segmentation2d
render_segmentation2d(seconds: float, camera: str, masks: Sequence[NDArrayU8], class_ids: Sequence[int], uuids: Sequence[str | None] | None = None) -> None
Render 2D segmentation image.
Parameters:
-
seconds
(float
) –Timestamp in [sec].
-
camera
(str
) –Name of camera channel.
-
masks
(Sequence[NDArrayU8]
) –Sequence of segmentation mask of each instance, each mask is the shape of (W, H).
-
class_ids
(Sequence[int]
) –Sequence of label ids.
-
uuids
(Sequence[str | None] | None
, default:None
) –Sequence of each instance ID.
render_pointcloud
Render pointcloud.
Parameters:
-
seconds
(float
) –Timestamp in [sec].
-
channel
(str
) –Name of the pointcloud sensor channel.
-
pointcloud
(PointCloudLike
) –Inherence object of
PointCloud
.
distance_color
distance_color(distances: Number | ArrayLike, cmap: str | None = None, v_min: float = 3.0, v_max: float = 75.0) -> tuple[float, float, float] | NDArrayF64
Return color map depending on distance values.
Parameters:
-
distances
(Number | ArrayLike
) –Array of distances in the shape of (N,).
-
cmap
(str | None
, default:None
) –Color map name in matplotlib. If None,
turbo_r
will be used. -
v_min
(float
, default:3.0
) –Min value to normalize.
-
v_max
(float
, default:75.0
) –Max value to normalize.
Returns:
-
tuple[float, float, float] | NDArrayF64
–Color map in the shape of (N,). If input type is any number, returns a color as
tuple[float, float, float]
. Otherwise, returns colors asNDArrayF64
.
format_entity
Format entity path.
Parameters:
-
root
(str
) –Root entity path.
-
*entities
–Entity path(s).
Returns:
-
str
–Formatted entity path.
Examples: