oakutils.nodes.buffer package

Module contents

Submodule for making sending and receiving data from the OAK-D easier.

Classes

Buffer

Class for creating a buffer for sending and receiving data from the OAK-D.

MultiBuffer

Class for creating a buffer for sending and receiving multiple data streams from the OAK-D.

SimpleBuffer

Class for creating a buffer for sending and receiving data from the OAK-D.

Functions

create_synced_buffer

Creates a function for getting packets of data from multiple streams.

class oakutils.nodes.buffer.Buffer(device: dai.DeviceBase, input_stream: str | list[str], output_stream: str | list[str])

Bases: object

Buffer for sending and receiving data from OAK-D.

cycle(data: np.ndarray | list[np.ndarray]) dai.ADatatype | list[dai.ADatatype]

Cycle data through the buffer.

Parameters:

data (np.ndarray | list[np.ndarray]) – The data to cycle through the buffer.

Returns:

The data cycled through the buffer.

Return type:

dai.ADatatype | list[dai.ADatatype]

receive() dai.ADatatype | list[dai.ADatatype]

Receive data from the buffer.

Returns:

The data received from the buffer.

Return type:

dai.ADataType | list[dai.ADatatype]

send(data: np.ndarray | list[np.ndarray]) None

Send data through the buffer.

Parameters:

data (np.ndarray | list[np.ndarray]) – The data to send through the buffer.

class oakutils.nodes.buffer.MultiBuffer(device: dai.DeviceBase, input_streams: Sequence[str | list[str]], output_streams: Sequence[str | list[str]])

Bases: object

Class for creating multiple Buffers for sending and receiving data from the OAK-D.

cycle(data: list[np.ndarray | list[np.ndarray]]) list[dai.ADatatype | list[dai.ADatatype]]

Cycle data through the multi buffer.

Parameters:

data (list[np.ndarray | list[np.ndarray]]) – The data to cycle through the buffer.

Returns:

The data received from the buffer.

Return type:

list[dai.ADatatype | list[dai.ADatatype]]

receive() list[dai.ADatatype | list[dai.ADatatype]]

Receive data from the multi buffer.

Returns:

The data received from the buffer.

Return type:

list[dai.ADatatype | list[dai.ADatatype]]

send(data: list[np.ndarray | list[np.ndarray]]) None

Send data through the multi buffer.

Parameters:

data (list[np.ndarray | list[np.ndarray]]) – The data to send through the buffer.

class oakutils.nodes.buffer.SimpleBuffer(device: dai.DeviceBase, input_stream: str, output_stream: str)

Bases: object

Buffer for sending and receiving data from OAK-D.

cycle(data: np.ndarray) dai.ADatatype

Cycle data through the buffer.

Parameters:

data (np.ndarray) – The data to cycle through the buffer.

Returns:

The data cycled through the buffer.

Return type:

dai.ADatatype

receive() dai.ADatatype

Receive data from the buffer.

Returns:

The data received from the buffer.

Return type:

dai.ADataType

send(data: np.ndarray) None

Send data through the buffer.

Parameters:

data (np.ndarray) – The data to send through the buffer.

oakutils.nodes.buffer.create_synced_buffer(device: dai.DeviceBase, streams: list[str]) PacketBuffer

Create a function for getting packets of data from multiple streams.

Parameters:
  • device (dai.DeviceBase) – The OAK-D device which the streams are built on.

  • streams (list[str]) – The output stream names for the buffer to receive data from.

Returns:

The buffer for receiving a packet of outputs from multiple streams.

Return type:

PacketBuffer