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: object

Image mode for specific return with explicit name.

Parameters:
  • mode (ImageMode)

  • name (str)

  • return_num (int)

mode: ImageMode
name: str
return_num: int = 0
class VizExtraMode(func)[source]

Bases: object

Image/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: object

Represents 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:

CloudPaletteItem

get_palette_by_name(name)[source]
Return type:

CloudPaletteItem

Parameters:

name (str)

get_current_palette()[source]

Gets the name of the current palette. :rtype: CloudPaletteItem

Return type:

CloudPaletteItem

triggered_live_zone_color(palette, zone_id)[source]
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
finalize()[source]
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: object

A model object representing viz state for a single sensor.

Parameters:
  • viz (PointViz)

  • _img_aspect_ratio (float)

  • palettes (Palettes)

  • index (int | None)

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:
Return type:

None

update_image(image, image_mode_item, frame)[source]

Update the view mode of the given image. :rtype: None

Parameters:
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:
update_object_id_cloud_and_image_masks(frame, mask_palette)[source]
Parameters:

frame (LidarFrame | None)

hide_all_zone_geometry()[source]
set_zone_selection_and_render_mode(selection_mode, render_mode)[source]
Parameters:
class LidarFrameVizModel(viz, metas, *, _img_aspect_ratio)[source]

Bases: object

Parameters:
finish()[source]

Stop any background processing

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

update_cloud_palette_name()[source]

Gets the name of the palette used for the point clouds.

update_cloud_palettes()[source]

Updates the point clouds to use the currently-selected palette.

sorted_cloud_mode_names()[source]

Returns all the cloud mode names.

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_objects_for_list(key, object_list)[source]
Parameters:

key (str)

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:
Return type:

None

clear_masks()[source]
clear_aoi()[source]
clear_object_selection()[source]
image_and_pixel_for_viewport_coordinate(ctx, x, y)[source]
mouse_button_handler(ctx, button, event, mods)[source]
Return type:

bool

Parameters:
update_3d_aoi(force_origin=False)[source]
update_aoi(ctx=None)[source]
Parameters:

ctx (WindowCtx | None)

mouse_pos_handler(ctx, x, y)[source]
Return type:

bool

Parameters:
update_aoi_label(frames)[source]
Parameters:

frames (FrameSet)

flip_images(flip)[source]
Return type:

None

Parameters:

flip (bool)

toggle_flip_images()[source]
Return type:

None

show_one_image(do)[source]
Return type:

None

Parameters:

do (bool)

update_image_size(amount)[source]

Change the size of the 2D image and position image labels. :rtype: None

Parameters:

amount (int)

Return type:

None

update_overlay_colors(palette)[source]