Function ouster::sdk::osf::slice_and_cast(const ouster::sdk::core::Frame&, const ouster::sdk::core::LidarFrameFieldTypes&)

Function Documentation

std::shared_ptr<ouster::sdk::core::Frame> ouster::sdk::osf::slice_and_cast(const ouster::sdk::core::Frame &src, const ouster::sdk::core::LidarFrameFieldTypes &field_types)

Cast src to a subset of fields with possible different underlying ChanFieldTypes.

The result is a copy of src carrying exactly field_types: fields that src holds under a different ChanFieldType (or field class, or extra dimensions) are cast into the requested one, fields src already holds as requested are copied unchanged, and everything else is dropped. Every other part of the frame — dimensions, timestamp / pose / status headers, objects, the associated sensor_info(), and any headers specific to the concrete frame type — comes across untouched.

The copy is made through Frame::clone(), so the returned frame has the same concrete type as src: hand it a LidarFrame and you get a LidarFrame, hand it a CameraFrame and you get a CameraFrame.

Throws:

std::invalid_argument – if a requested field is missing from src, or if a field needing a cast cannot be cast (casting is supported for two-dimensional fields only).

Parameters:
  • src[in] The frame to cast.

  • field_types[in] The field types to cast the frame to.

Returns:

a copy of src with transformed fields.