ouster.sdk.viz.core module¶
Copyright (c) 2021, Ouster, Inc. All rights reserved.
Sensor data visualization tools.
Visualize lidar data using OpenGL.
- class ImuVisualizationConfig(options='only_gyro')[source]¶
Bases:
object- imu_plot_width_pixels = 1000¶
- imu_plot_height_pixels = 28¶
- downsample_factor = 2¶
- field_colors = {'IMU_ACC': (1.0, 0.0, 0.0, 1.0), 'IMU_GYRO': (1.0, 1.0, 1.0, 1.0)}¶
- class LidarFrameViz(metas, point_viz=None, accumulators_config=None, imu_viz_config=<ouster.sdk.viz.core.ImuVisualizationConfig object>, *, _img_aspect_ratio=0, _buflen=50, _add_default_controls=True)[source]¶
Bases:
objectMulti LidarFrame clouds visualizer
Uses the supplied PointViz instance to easily display the contents of a LidarFrame. Sets up key bindings to toggle which channel fields and returns are displayed, and change 2D image and point size.
- Parameters:
metas (
List[SensorInfo]) – sensor metadata used to interpret framesviz – use an existing PointViz instance instead of creating one
point_viz (PointViz | None)
accumulators_config (LidarFrameVizAccumulatorsConfig | None)
imu_viz_config (ImuVisualizationConfig)
_img_aspect_ratio (float)
- class OsdState(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum- NONE = (1,)¶
- DEFAULT = (2,)¶
- HELP = 3¶
- class FlagsMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum- NONE = 0¶
- HIGHLIGHT_SECOND = 1¶
- HIGHLIGHT_BLOOM = 2¶
- HIDE_BLOOM = 3¶
- HIGHLIGHT_ZONES = 4¶
- HIGHLIGHT_OBJECTS = 5¶
- class ImagesLayout(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum- HORIZONTAL = 0¶
- VERTICAL = 1¶
- class CameraMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum- FOLLOW = 0¶
- FOLLOW_ROTATION_LOCKED = 1¶
- FIXED = 2¶
- FOLLOW_SMOOTH = 3¶
- FOLLOW_SMOOTH_ROTATION_LOCK = 4¶
- class TrackViewMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum- OFF = 0¶
- TRACK_ONLY = 1¶
- TRACK_PLUS_PER_FRAME_TRAJECTORY = 2¶
- class ImageViewMode(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum- ALL = 0¶
- ALL_FLIPPED = 1¶
- ONE = 2¶
- ONE_FLIPPED = 3¶
- class FlagsPalette(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶
Bases:
Enum- RAINBOW = 0¶
- DISTINCT = 1¶
- clear_pose_histories()[source]¶
Clear frame/camera pose histories used for interpolation. :rtype:
None- Return type:
None
- 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
- toggle_sky()[source]¶
Toggle showing the color the sky in the pointcloud where there is no return :rtype:
None- Return type:
None
- MAX_SENSOR_TOGGLE_KEYS = 9¶
- select_img_mode(i, mode)[source]¶
Change the displayed field of the i’th image. :rtype:
bool- Parameters:
i (int)
mode (str)
- Return type:
bool
- cycle_img_mode(i, *, direction=1)[source]¶
Change the displayed field of the i’th image. :rtype:
None- Parameters:
i (int)
direction (int)
- Return type:
None
- select_cloud_mode(mode)[source]¶
Change the coloring mode of the 3D point cloud. :rtype:
bool- Parameters:
mode (str)
- Return type:
bool
- cycle_cloud_mode(direction=1)[source]¶
Change the coloring mode of the 3D point cloud. :rtype:
None- Parameters:
direction (int)
- Return type:
None
- cycle_cloud_palette(*, direction=1)[source]¶
Change the color palette of the 3D point cloud. :rtype:
None- Parameters:
direction (int)
- Return type:
None
- toggle_cloud(i)[source]¶
Toggle whether the i’th return is displayed. :rtype:
None- Parameters:
i (int)
- Return type:
None
- toggle_sensor(sensor_index)[source]¶
Toggle whether the i’th sensor data is displayed. :rtype:
None- Parameters:
sensor_index (int)
- Return type:
None
- update_point_size(amount)[source]¶
Change the point size of the 3D cloud. :rtype:
None- Parameters:
amount (int)
- Return type:
None
- update_image_size(amount)[source]¶
Change the size of the 2D image and position image labels. :rtype:
None- Parameters:
amount (int)
- Return type:
None
- toggle_flip_images()[source]¶
Toggle if 2D images should be flipped or not. :rtype:
None- Return type:
None
- update_ring_size(amount)[source]¶
Change distance ring size. :rtype:
None- Parameters:
amount (int)
- Return type:
None
- toggle_osd(state=None)[source]¶
Show or hide the on-screen display. :rtype:
None- Parameters:
state (bool | None)
- Return type:
None
- cycle_camera_mode(direction=1)[source]¶
Toggle the camera follow mode. :rtype:
None- Parameters:
direction (int)
- Return type:
None
- update_flags_mode(mode=None, direction=1)[source]¶
- Return type:
None- Parameters:
mode (FlagsMode | None)
direction (int)
- cycle_flags_palette()[source]¶
Cycle the palette used for flags modes. :rtype:
None- Return type:
None
- cycle_object_color_mode()[source]¶
Cycle the mode used for object highlighting. :rtype:
None- Return type:
None
- toggle_axis_markers()[source]¶
Toggle the helper axis of a frame ON/OFF :rtype:
None- Return type:
None
- property frame_num: int¶
The currently displayed frame number
- update(frames, frame_num=None, last_n_frame_sets=[])[source]¶
Update the LidarFrameViz state with the provided frames. :rtype:
None
- draw(update=True, update_camera=True)[source]¶
Process and draw the latest state to the screen. :rtype:
None- Parameters:
update (bool)
update_camera (bool)
- Return type:
None
- run()[source]¶
Run the rendering loop of the visualizer.
See
PointViz.run():rtype:None- Return type:
None
- set_zone_selection_and_render_modes(sel_mode, render_mode)[source]¶
- Return type:
None- Parameters:
sel_mode (ZoneSelectionMode)
render_mode (ZoneRenderMode)
- class LiveConsumer(iterable, should_count_dropped_frame_method)[source]¶
Bases:
objectSpawns a thread to consume frames as soon as they’re available. This is a work-around to deal with situations where the visualizer is too slow to keep up with a live sensor.
- property dropped_frames¶
- class SimpleViz(metadata, *, rate=None, pause_at=-1, on_eof='exit', accum_max_num=0, accum_min_dist_meters=0, accum_min_dist_num=1, map_enabled=False, map_select_ratio=0.001, map_max_points=1500000, imu_viz_config=<ouster.sdk.viz.core.ImuVisualizationConfig object>, title='Ouster Viz', maximized=False, fullscreen=False, resolution=None, screenshot_resolution=None, _override_pointviz=None, _override_lidar_frame_viz=None, _buflen=50, video_format='png', clear_on_loop=False, subframes=0)[source]¶
Bases:
objectVisualize a stream of LidarFrames.
Handles controls for playback speed, pausing and stepping.
- Parameters:
arg – Metadata associated with the frames to be visualized or a LidarFrameViz instance to use.
rate (
Optional[float]) – Playback rate. One of 0.25, 0.5, 0.75, 1.0, 1.5, 2.0, 3.0 or None for “live” playback (the default).pause_at (
int) – frame number to pause at, default (-1) - no auto pause, to stop after the very first frame use 0on_eof (
str) – What to do when the source ends. One of ‘exit’, ‘stop’ or ‘loop’video_format (
str) – Format for saving continuous screenshots. One of ‘png’ or ‘gif’metadata (List[SensorInfo] | SensorInfo)
accum_max_num (int)
accum_min_dist_meters (float)
accum_min_dist_num (int)
map_enabled (bool)
map_select_ratio (float)
map_max_points (int)
imu_viz_config (ImuVisualizationConfig)
title (str)
maximized (bool)
fullscreen (bool)
resolution (Tuple[int, int] | None)
screenshot_resolution (Tuple[int, int] | float | None)
_override_pointviz (PointViz | None)
_override_lidar_frame_viz (LidarFrameViz | None)
_buflen (int)
clear_on_loop (bool)
- Raises:
ValueError – if the specified rate isn’t one of the options
- seek_relative(n_frames)[source]¶
Seek forward of backwards in the stream. :rtype:
None- Parameters:
n_frames (int)
- Return type:
None
- modify_rate(amount)[source]¶
Switch between preset playback rates. :rtype:
None- Parameters:
amount (int)
- Return type:
None
- toggle_osd(state=None)[source]¶
Show or hide the on-screen display. :rtype:
None- Parameters:
state (bool | None)
- Return type:
None
- set_class_maps(class_maps)[source]¶
Set the class maps for the visualizer. :rtype:
None- Parameters:
class_maps (ClassMapSet)
- Return type:
None
- property frames_per_sec: float¶
Frames per second processing rate.
- property scans_per_sec: float¶
use frames_per_sec.
- Type:
Deprecated
- run(frames)[source]¶
Start reading frames and visualizing the stream.
Must be called from the main thread on macOS. Will close the provided frame source before returning.
- Parameters:
frames (
Union[Iterable[FrameSet],Iterable[LidarFrame],Iterable[List[Optional[LidarFrame]]]]) – A stream of frames to visualize.- Return type:
None- Returns:
When the stream is consumed or the visualizer window is closed.
- lf_show(frames, *, title=None)[source]¶
[BETA] Display a set of LidarFrames in an interactive window.
- Parameters:
frames (
Union[FrameSetSource,LidarFrame,FrameSet,List[Optional[LidarFrame]],List[List[Optional[LidarFrame]]]]) – A set of LidarFrames to visualize.title (str | None)
- Return type:
None
- Optional Args:
- title: Title of the visualization window. If not provided,
it will be composed from the sensor serial numbers.
Note
This is a beta feature and its API may change in future releases.