ouster.sdk.viz.model module¶
Copyright (c) 2021, Ouster, Inc. All rights reserved.
Types for managing visualization state.
- class ZoneSelectionMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum- NONE = 0¶
- LIVE = 1¶
- ALL = 2¶
- class ZoneRenderMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum- STL = 0¶
- CLOUDS = 1¶
- STL_AND_CLOUDS = 2¶
- VOXEL_MESH = 3¶
- class ObjectColorMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum- OBJECT_ID = 0¶
- OBJECT_CLASS = 1¶
- class ObjectViewMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum- OVERLAY_AND_MAIN_VIEW = 0¶
- OVERLAY_ONLY = 1¶
- MAIN_VIEW_ONLY = 2¶
- NONE = 3¶
- class ImgModeItem(mode, name, return_num=0)[source]¶
Bases:
objectImage mode for specific return with explicit name.
- Parameters:
mode (ImageMode)
name (str)
return_num (int)
-
name:
str¶
-
return_num:
int= 0¶
- class VizExtraMode(func)[source]¶
Bases:
objectImage/Cloud mode factory func
Used to embed viz modes from external plugins.
- Parameters:
func (Callable[[], ImageCloudMode | ImageMode | CloudMode])
-
func:
Callable[[],Union[ImageCloudMode,ImageMode,CloudMode]]¶
- create(info=None)[source]¶
- Return type:
Union[ImageCloudMode,ImageMode,CloudMode]- Parameters:
info (SensorInfo | None)
- class Palettes(_ext_palettes)[source]¶
Bases:
objectRepresents the color palettes used within an instance of LidarFrameViz. Also keeps track of the palette currently in use.
Initialize a Palettes object, which populates two lists of palettes - one for normal view modes and one for ReflMode.
- Parameters:
_ext_palettes (List[CloudPaletteItem])
- set_palette(index)[source]¶
Set the current palette index. :rtype:
None- Parameters:
index (int)
- Return type:
None
- cycle_cloud_palette(direction)[source]¶
Updates the current palette to use. :rtype:
None- Parameters:
direction (int)
- Return type:
None
- get_palette(cloud_mode)[source]¶
Gets the current color palette depending on the view mode. :rtype:
CloudPaletteItem- Parameters:
cloud_mode (CloudMode)
- Return type:
- get_current_palette()[source]¶
Gets the name of the current palette. :rtype:
CloudPaletteItem- Return type:
- class Selection2d(p1, p2, sensor_index, sensor, image_index, image)[source]¶
Bases:
object- Parameters:
p1 (Tuple[int, int])
p2 (Tuple[int, int])
sensor_index (int)
sensor (SensorModel)
image_index (int)
image (Image)
- property sensor¶
- property finalized¶
- property p1¶
- property p2¶
- property area: int¶
Calculates and returns the area of the rectangular selection.
The area is calculated as the absolute difference between the x and y coordinates, ensuring a positive result regardless of the points’ order.
- class SensorModel(viz, meta, *, _img_aspect_ratio=0, palettes=<ouster.sdk.viz.model.Palettes object>, index=None)[source]¶
Bases:
objectA model object representing viz state for a single sensor.
- update_cloud_palettes(cloud_mode_name)[source]¶
Sets each cloud palette given the cloud mode name. Has no effect if the cloud mode is not available for this sensor. :rtype:
None- Return type:
None
- update_cloud(cloud, cloud_mode, range_field, return_num, frame)[source]¶
Updates the given Cloud with the given CloudMode. :rtype:
None- Parameters:
range_field (str)
return_num (int)
frame (LidarFrame | None)
- Return type:
None
- update_clouds(cloud_mode_name, frame)[source]¶
Update range and mode for each cloud given a mode name and a frame. :rtype:
None- Parameters:
cloud_mode_name (str)
frame (LidarFrame | None)
- Return type:
None
- update_image(image, image_mode_item, frame)[source]¶
Update the view mode of the given image. :rtype:
None- Parameters:
image_mode_item (ImgModeItem)
frame (LidarFrame | None)
- Return type:
None
- update_images(image_mode_names, frame)[source]¶
Update image values and mode given mode names and a frame. :rtype:
None- Parameters:
image_mode_names (List[str])
frame (LidarFrame | None)
- Return type:
None
- update_zones(frame=None)[source]¶
- Return type:
None- Parameters:
frame (LidarFrame | None)
- update_zone_occupancy_cloud_and_image_masks(frame, palettes)[source]¶
- Parameters:
frame (LidarFrame | None)
palettes (Palettes)
- update_object_id_cloud_and_image_masks(frame, mask_palette)[source]¶
- Parameters:
frame (LidarFrame | None)
- set_zone_selection_and_render_mode(selection_mode, render_mode)[source]¶
- Parameters:
selection_mode (ZoneSelectionMode)
render_mode (ZoneRenderMode)
- class LidarFrameVizModel(viz, metas, *, _img_aspect_ratio)[source]¶
Bases:
object- Parameters:
viz (PointViz)
metas (List[SensorInfo])
_img_aspect_ratio (float)
- property metadata: List[SensorInfo]¶
Metadatas for the displayed sensors.
- set_class_maps(class_maps)[source]¶
Set the class maps for the visualizer. :rtype:
None- Parameters:
class_maps (ClassMapSet)
- Return type:
None
- sorted_image_mode_names()[source]¶
Returns the image mode names, limited to those for fields we’ve seen in at least one LidarFrame.
- select_cloud_mode(name)[source]¶
Updates the currently selected cloud mode from the list of all available cloud modes. Returns false if the requested mode is not available. :rtype:
bool- Parameters:
name (str)
- Return type:
bool
- cycle_cloud_mode(direction)[source]¶
Updates the currently selected cloud mode from the list of all available cloud modes.
- Parameters:
direction (int)
- select_image_mode(i, name)[source]¶
Updates the currently selected image mode from the list of all available cloud modes. Returns false if the requested mode is not available. :rtype:
bool- Parameters:
i (int)
name (str)
- Return type:
bool
- cycle_image_mode(i, direction)[source]¶
Updates the currently selected image mode from the list of all available cloud modes.
- Parameters:
i (int)
direction (int)
- update_object_cuboids()[source]¶
Add or remove cuboids from the viz based on the current object view mode. :rtype:
None- Return type:
None
- update_objects(frames)[source]¶
Update the objects in the viz from the given FrameSet. :rtype:
None- Parameters:
frames (FrameSet)
- Return type:
None
- update(frames, new_frames=True)[source]¶
Update the LidarFrameViz state with the provided frames. :rtype:
None- Parameters:
frames (FrameSet)
new_frames (bool)
- Return type:
None
- mouse_button_handler(ctx, button, event, mods)[source]¶
- Return type:
bool- Parameters:
ctx (WindowCtx)
button (MouseButton)
event (MouseButtonEvent)
mods (EventModifierKeys)
- mouse_pos_handler(ctx, x, y)[source]¶
- Return type:
bool- Parameters:
ctx (WindowCtx)
x (float)
y (float)