ouster.sdk.examples.reference module

Copyright (c) 2021, Ouster, Inc. All rights reserved.

Reference implementations of common operations.

xyz_proj_beam_to_sensor_transform(metadata, scan)[source]

Computes a point cloud from a scan as numpy array.

This is a reference implementation that follows the calculations from Section X of the Software User Manual exactly. Output is a point cloud in the sensor frame with points arranged in column-major order, with coordinates in meters.

Parameters:
  • metadata (SensorInfo) – Sensor metadata associated with the scan

  • scan (LidarScan) – A frame of lidar data

Return type:

ndarray

Returns:

A H x W x 3 array of point coordinates

xyz_proj_origin_to_origin_mm(metadata, scan)[source]

Computes a point cloud from a scan as numpy array

This is the old reference implementation that follows the calculations from Section 3.1.2 of the FW 2.0 Software User Manual exactly for OS-0, OS-1, and OS-2 sensors. The output is a point cloud in the sensor frame with points arranged in column-major order, with coordinates in meters.

Parameters:
  • metadata (SensorInfo) – Sensor metadata associated with the scan

  • scan (LidarScan) – A frame of lidar data

Return type:

ndarray

Returns:

A H x W x 3 array of point coordinates

destagger(pixel_shift_by_row, field)[source]

Reference implementation for destaggering a field of data.

In the default staggered representation, each column corresponds to a single timestamp. In the destaggered representation, each column corresponds to a single azimuth angle, compensating for the azimuth offset of each beam.

Destaggering is used for visualizing lidar data as an image or for algorithms that exploit the structure of the lidar data, such as beam_uniformity in ouster_viz, or computer vision algorithms.

Parameters:
  • pixel_shift_by_row (List[int]) – List of pixel shifts by row from sensor metadata

  • field (ndarray) – Staggered data as a H x W numpy array

Return type:

ndarray

Returns:

Destaggered data as a H x W numpy array