C++ API Reference

namespace dai

Enums

enum CameraBoardSocket

Which Camera socket to use.

AUTO denotes that the decision will be made by device

Values:

enumerator AUTO
enumerator RGB
enumerator LEFT
enumerator RIGHT
enum CameraImageOrientation

Camera sensor image orientation / pixel readout. This exposes direct sensor settings. 90 or 270 degrees rotation is not available.

AUTO denotes that the decision will be made by device (e.g. on OAK-1/megaAI: ROTATE_180_DEG).

Values:

enumerator AUTO
enumerator NORMAL
enumerator HORIZONTAL_MIRROR
enumerator VERTICAL_FLIP
enumerator ROTATE_180_DEG
enum CameraModel

Which CameraModel to initialize the calibration with.

Values:

enumerator Perspective
enumerator Fisheye
enumerator Equirectangular
enumerator RadialDivision
enum ProcessorType

On which processor the node will be placed

Enum specifying processor

Values:

enumerator LEON_CSS
enumerator LEON_MSS
enum UsbSpeed

Get USB Speed

Values:

enumerator UNKNOWN
enumerator LOW
enumerator FULL
enumerator HIGH
enumerator SUPER
enumerator SUPER_PLUS
enum DatatypeEnum

Values:

enumerator Buffer
enumerator ImgFrame
enumerator NNData
enumerator ImageManipConfig
enumerator CameraControl
enumerator ImgDetections
enumerator SpatialImgDetections
enumerator SystemInformation
enumerator SpatialLocationCalculatorConfig
enumerator SpatialLocationCalculatorData
enumerator EdgeDetectorConfig
enumerator Tracklets
enumerator IMUData
enumerator StereoDepthConfig
enumerator FeatureTrackerConfig
enumerator TrackedFeatures
enum SpatialLocationCalculatorAlgorithm

Values:

enumerator AVERAGE
enumerator MIN
enumerator MAX
enum MedianFilter

Median filter config for disparity post-processing

Values:

enumerator MEDIAN_OFF
enumerator KERNEL_3x3
enumerator KERNEL_5x5
enumerator KERNEL_7x7
enum LogLevel

Values:

enumerator TRACE
enumerator DEBUG
enumerator INFO
enumerator WARN
enumerator ERR
enumerator CRITICAL
enumerator OFF
enum IMUSensor

Available IMU sensors. More details about each sensor can be found in the datasheet:

https://www.ceva-dsp.com/wp-content/uploads/2019/10/BNO080_085-Datasheet.pdf

Values:

enumerator ACCELEROMETER_RAW

Section 2.1.1

Acceleration of the device without any postprocessing, straight from the sensor. Units are [m/s^2]

enumerator ACCELEROMETER

Section 2.1.1

Acceleration of the device including gravity. Units are [m/s^2]

enumerator LINEAR_ACCELERATION

Section 2.1.1

Acceleration of the device with gravity removed. Units are [m/s^2]

enumerator GRAVITY

Section 2.1.1

Gravity. Units are [m/s^2]

enumerator GYROSCOPE_RAW

Section 2.1.2

The angular velocity of the device without any postprocessing, straight from the sensor. Units are [rad/s]

enumerator GYROSCOPE_CALIBRATED

Section 2.1.2

The angular velocity of the device. Units are [rad/s]

enumerator GYROSCOPE_UNCALIBRATED

Section 2.1.2

Angular velocity without bias compensation. Units are [rad/s]

enumerator MAGNETOMETER_RAW

Section 2.1.3

Magnetic field measurement without any postprocessing, straight from the sensor. Units are [uTesla]

enumerator MAGNETOMETER_CALIBRATED

Section 2.1.3

The fully calibrated magnetic field measurement. Units are [uTesla]

enumerator MAGNETOMETER_UNCALIBRATED

Section 2.1.3

The magnetic field measurement without hard-iron offset applied. Units are [uTesla]

enumerator ROTATION_VECTOR

Section 2.2

The rotation vector provides an orientation output that is expressed as a quaternion referenced to magnetic north and gravity. It is produced by fusing the outputs of the accelerometer, gyroscope and magnetometer. The rotation vector is the most accurate orientation estimate available. The magnetometer provides correction in yaw to reduce drift and the gyroscope enables the most responsive performance.

enumerator GAME_ROTATION_VECTOR

Section 2.2

The game rotation vector is an orientation output that is expressed as a quaternion with no specific reference for heading, while roll and pitch are referenced against gravity. It is produced by fusing the outputs of the accelerometer and the gyroscope (i.e. no magnetometer). The game rotation vector does not use the magnetometer to correct the gyroscopes drift in yaw. This is a deliberate omission (as specified by Google) to allow gaming applications to use a smoother representation of the orientation without the jumps that an instantaneous correction provided by a magnetic field update could provide. Long term the output will likely drift in yaw due to the characteristics of gyroscopes, but this is seen as preferable for this output versus a corrected output.

enumerator GEOMAGNETIC_ROTATION_VECTOR

Section 2.2

The geomagnetic rotation vector is an orientation output that is expressed as a quaternion referenced to magnetic north and gravity. It is produced by fusing the outputs of the accelerometer and magnetometer. The gyroscope is specifically excluded in order to produce a rotation vector output using less power than is required to produce the rotation vector of section 2.2.4. The consequences of removing the gyroscope are: Less responsive output since the highly dynamic outputs of the gyroscope are not used More errors in the presence of varying magnetic fields.

enumerator ARVR_STABILIZED_ROTATION_VECTOR

Section 2.2

Estimates of the magnetic field and the roll/pitch of the device can create a potential correction in the rotation vector produced. For applications (typically augmented or virtual reality applications) where a sudden jump can be disturbing, the output is adjusted to prevent these jumps in a manner that takes account of the velocity of the sensor system.

enumerator ARVR_STABILIZED_GAME_ROTATION_VECTOR

Section 2.2

While the magnetometer is removed from the calculation of the game rotation vector, the accelerometer itself can create a potential correction in the rotation vector produced (i.e. the estimate of gravity changes). For applications (typically augmented or virtual reality applications) where a sudden jump can be disturbing, the output is adjusted to prevent these jumps in a manner that takes account of the velocity of the sensor system. This process is called AR/VR stabilization.

enum TrackerType

Values:

enumerator SHORT_TERM_KCF

Kernelized Correlation Filter tracking.

enumerator SHORT_TERM_IMAGELESS

Short term tracking without using image data.

enumerator ZERO_TERM_IMAGELESS

Ability to track the objects without accessing image data.

enumerator ZERO_TERM_COLOR_HISTOGRAM

Tracking using image data too.

enum TrackerIdAssigmentPolicy

Values:

enumerator UNIQUE_ID

Always take a new, unique ID.

enumerator SMALLEST_ID

Take the smallest available ID.

Functions

bool initialize(std::string additionalInfo = "", bool installSignalHandler = true)
bool isDatatypeSubclassOf(DatatypeEnum parent, DatatypeEnum children)

Variables

constexpr uint32_t PREBOOT_CONFIG_MAGIC1 = 0x78010000U
constexpr uint32_t PREBOOT_CONFIG_MAGIC2 = 0x21ea17e6U
constexpr const char *LOG_DEFAULT_PATTERN = "[%E.%e] [%n] [%^%l%$] %v"
class ADatatype
#include <ADatatype.hpp>

Abstract message.

Subclassed by dai::Buffer

struct Asset
#include <AssetManager.hpp>

Asset is identified with string key and can store arbitrary binary data.

class AssetManager
#include <AssetManager.hpp>

AssetManager can store assets and serialize.

Public Functions

void addExisting(std::vector<std::shared_ptr<Asset>> assets)

Adds all assets in an array to the AssetManager

Parameters
  • assets: Vector of assets to add

std::shared_ptr<dai::Asset> set(Asset asset)

Adds or overwrites an asset object to AssetManager.

Return

Shared pointer to asset

Parameters

std::shared_ptr<dai::Asset> set(const std::string &key, Asset asset)

Adds or overwrites an asset object to AssetManager with a specificied key. Key value will be assigned to an Asset as well

Return

Shared pointer to asset

Parameters
  • key: Key under which the asset should be stored

  • asset: Asset to store

std::shared_ptr<dai::Asset> set(const std::string &key, const std::string &path, int alignment = 64)

Loads file into asset manager under specified key.

Parameters
  • key: Key under which the asset should be stored

  • path: Path to file which to load as asset

  • alignment: [Optional] alignment of asset data in asset storage. Default is 64B

std::shared_ptr<dai::Asset> set(const std::string &key, const std::vector<std::uint8_t> &data, int alignment = 64)

Loads file into asset manager under specified key.

Return

Shared pointer to asset

Parameters
  • key: Key under which the asset should be stored

  • data: Asset data

  • alignment: [Optional] alignment of asset data in asset storage. Default is 64B

std::shared_ptr<const Asset> get(const std::string &key) const

Return

Asset assigned to the specified key or a nullptr otherwise

std::shared_ptr<Asset> get(const std::string &key)

Return

Asset assigned to the specified key or a nullptr otherwise

std::vector<std::shared_ptr<const Asset>> getAll() const

Return

All asset stored in the AssetManager

std::vector<std::shared_ptr<Asset>> getAll()

Return

All asset stored in the AssetManager

std::size_t size() const

Return

Number of asset stored in the AssetManager

void remove(const std::string &key)

Removes asset with key

Parameters
  • key: Key of asset to remove

void serialize(AssetsMutable &assets, std::vector<std::uint8_t> &assetStorage, std::string prefix = "") const

Serializes.

class Assets

Subclassed by dai::AssetsMutable

class AssetsMutable : public dai::Assets
struct AssetView
class Buffer : public dai::ADatatype
#include <Buffer.hpp>

Base message - buffer of binary data.

Subclassed by dai::CameraControl, dai::EdgeDetectorConfig, dai::FeatureTrackerConfig, dai::ImageManipConfig, dai::ImgDetections, dai::ImgFrame, dai::IMUData, dai::NNData, dai::SpatialImgDetections, dai::SpatialLocationCalculatorConfig, dai::SpatialLocationCalculatorData, dai::StereoDepthConfig, dai::SystemInformation, dai::TrackedFeatures, dai::Tracklets

Public Functions

Buffer()

Creates Buffer message.

std::vector<std::uint8_t> &getData()

Return

Reference to internal buffer

void setData(std::vector<std::uint8_t> data)

Parameters
  • data: Copies data to internal buffer

class CalibrationHandler
#include <CalibrationHandler.hpp>

CalibrationHandler is an interface to read/load/write structured calibration and device data.

Public Functions

CalibrationHandler(std::string eepromDataPath)

Construct a new Calibration Handler object using the eeprom json file created from calibration procedure.

Parameters
  • eepromDataPath: takes the full path to the json file containing the calibration and device info.

CalibrationHandler(std::string calibrationDataPath, std::string boardConfigPath)

Construct a new Calibration Handler object using the board config json file and .calib binary files created using gen1 calibration.

Parameters
  • calibrationDataPath: Full Path to the .calib binary file from the gen1 calibration. (Supports only Version 5)

  • boardConfigPath: Full Path to the board config json file containing device information.

CalibrationHandler(EepromData eepromData)

Construct a new Calibration Handler object from EepromData object.

Parameters
  • eepromData: EepromData data structure containing the calibration data.

dai::EepromData getEepromData() const

Get the Eeprom Data object

Return

EepromData object which contains the raw calibration data

std::vector<std::vector<float>> getCameraIntrinsics(CameraBoardSocket cameraId, int resizeWidth = -1, int resizeHeight = -1, Point2f topLeftPixelId = Point2f(), Point2f bottomRightPixelId = Point2f())

Get the Camera Intrinsics object

Matrix representation of intrinsic matrix

\[\begin{split} \text{Intrinsic Matrix} = \left [ \begin{matrix} f_x & 0 & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{matrix} \right ] \end{split}\]
Return

Repesents the 3x3 intrinsics matrix of the respective camera at the requested size and crop dimensions.

Parameters
  • cameraId: Uses the cameraId to identify which camera intrinsics to return

  • resizewidth: resized width of the image for which intrinsics is requested. resizewidth = -1 represents width is same as default intrinsics

  • resizeHeight: resized height of the image for which intrinsics is requested. resizeHeight = -1 represents height is same as default intrinsics

  • topLeftPixelId: (x, y) point represents the top left corner coordinates of the cropped image which is used to modify the intrinsics for the respective cropped image

  • bottomRightPixelId: (x, y) point represents the bottom right corner coordinates of the cropped image which is used to modify the intrinsics for the respective cropped image

std::vector<std::vector<float>> getCameraIntrinsics(CameraBoardSocket cameraId, Size2f destShape, Point2f topLeftPixelId = Point2f(), Point2f bottomRightPixelId = Point2f())

Get the Camera Intrinsics object

Matrix representation of intrinsic matrix

\[\begin{split} \text{Intrinsic Matrix} = \left [ \begin{matrix} f_x & 0 & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{matrix} \right ] \end{split}\]
Return

Repesents the 3x3 intrinsics matrix of the respective camera at the requested size and crop dimensions.

Parameters
  • cameraId: Uses the cameraId to identify which camera intrinsics to return

  • destShape: resized width and height of the image for which intrinsics is requested.

  • topLeftPixelId: (x, y) point represents the top left corner coordinates of the cropped image which is used to modify the intrinsics for the respective cropped image

  • bottomRightPixelId: (x, y) point represents the bottom right corner coordinates of the cropped image which is used to modify the intrinsics for the respective cropped image

std::vector<std::vector<float>> getCameraIntrinsics(CameraBoardSocket cameraId, std::tuple<int, int> destShape, Point2f topLeftPixelId = Point2f(), Point2f bottomRightPixelId = Point2f())

Get the Camera Intrinsics object

Matrix representation of intrinsic matrix

\[\begin{split} \text{Intrinsic Matrix} = \left [ \begin{matrix} f_x & 0 & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{matrix} \right ] \end{split}\]
Return

Repesents the 3x3 intrinsics matrix of the respective camera at the requested size and crop dimensions.

Parameters
  • cameraId: Uses the cameraId to identify which camera intrinsics to return

  • destShape: resized width and height of the image for which intrinsics is requested.

  • topLeftPixelId: (x, y) point represents the top left corner coordinates of the cropped image which is used to modify the intrinsics for the respective cropped image

  • bottomRightPixelId: (x, y) point represents the bottom right corner coordinates of the cropped image which is used to modify the intrinsics for the respective cropped image

std::tuple<std::vector<std::vector<float>>, int, int> getDefaultIntrinsics(CameraBoardSocket cameraId)

Get the Default Intrinsics object

Matrix representation of intrinsic matrix

\[\begin{split} \text{Intrinsic Matrix} = \left [ \begin{matrix} f_x & 0 & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{matrix} \right ] \end{split}\]
Return

Repesents the 3x3 intrinsics matrix of the respective camera along with width and height at which it was calibrated.

Parameters
  • cameraId: Uses the cameraId to identify which camera intrinsics to return

std::vector<float> getDistortionCoefficients(CameraBoardSocket cameraId)

Get the Distortion Coefficients object

Return

the distortion coefficients of the requested camera in this order: [k1,k2,p1,p2,k3,k4,k5,k6,s1,s2,s3,s4,τx,τy]

Parameters
  • cameraId: Uses the cameraId to identify which distortion Coefficients to return.

float getFov(CameraBoardSocket cameraId, bool useSpec = true)

Get the Fov of the camera

Return

field of view of the camera with given cameraId.

Parameters
  • cameraId: of the camera of which we are fetching fov.

  • useSpec: Disabling this bool will calculate the fov based on intrinsics (focal length, image width), instead of getting it from the camera specs

uint8_t getLensPosition(CameraBoardSocket cameraId)

Get the lens position of the given camera

Return

lens postion of the camera with given cameraId at which it was calibrated.

Parameters
  • cameraId: of the camera with lens position is requested.

std::vector<std::vector<float>> getCameraExtrinsics(CameraBoardSocket srcCamera, CameraBoardSocket dstCamera, bool useSpecTranslation = false)

Get the Camera Extrinsics object between two cameras from the calibration data if there is a linked connection between any two cameras then the relative rotation and translation (in centimeters) is returned by this function.

Matrix representation of transformation matrix

\[\begin{split} \text{Transformation Matrix} = \left [ \begin{matrix} r_{00} & r_{01} & r_{02} & T_x \\ r_{10} & r_{11} & r_{12} & T_y \\ r_{20} & r_{21} & r_{22} & T_z \\ 0 & 0 & 0 & 1 \end{matrix} \right ] \end{split}\]
Return

a transformationMatrix which is 4x4 in homogenious coordinate system

Parameters
  • srcCamera: Camera Id of the camera which will be considerd as origin.

  • dstCamera: Camera Id of the destination camera to which we are fetching the rotation and translation from the SrcCamera

  • useSpecTranslation: Enabling this bool uses the translation information from the board design data

std::vector<float> getCameraTranslationVector(CameraBoardSocket srcCamera, CameraBoardSocket dstCamera, bool useSpecTranslation = true)

Get the Camera translation vector between two cameras from the calibration data.

Return

a translation vector like [x, y, z] in centimeters

Parameters
  • srcCamera: Camera Id of the camera which will be considerd as origin.

  • dstCamera: Camera Id of the destination camera to which we are fetching the translation vector from the SrcCamera

  • useSpecTranslation: Disabling this bool uses the translation information from the calibration data (not the board design data)

float getBaselineDistance(CameraBoardSocket cam1 = CameraBoardSocket::RIGHT, CameraBoardSocket cam2 = CameraBoardSocket::LEFT, bool useSpecTranslation = true)

Get the baseline distance between two specified cameras. By default it will get the baseline between CameraBoardSocket.RIGHT and CameraBoardSocket.LEFT.

Return

baseline distance in centimeters

Parameters
  • cam1: First camera

  • cam2: Second camera

  • useSpecTranslation: Enabling this bool uses the translation information from the board design data (not the calibration data)

std::vector<std::vector<float>> getCameraToImuExtrinsics(CameraBoardSocket cameraId, bool useSpecTranslation = false)

Get the Camera To Imu Extrinsics object From the data loaded if there is a linked connection between IMU and the given camera then there relative rotation and translation from the camera to IMU is returned.

Matrix representation of transformation matrix

\[\begin{split} \text{Transformation Matrix} = \left [ \begin{matrix} r_{00} & r_{01} & r_{02} & T_x \\ r_{10} & r_{11} & r_{12} & T_y \\ r_{20} & r_{21} & r_{22} & T_z \\ 0 & 0 & 0 & 1 \end{matrix} \right ] \end{split}\]
Return

Returns a transformationMatrix which is 4x4 in homogenious coordinate system

Parameters
  • cameraId: Camera Id of the camera which will be considerd as origin. from which Transformation matrix to the IMU will be found

  • useSpecTranslation: Enabling this bool uses the translation information from the board design data

std::vector<std::vector<float>> getImuToCameraExtrinsics(CameraBoardSocket cameraId, bool useSpecTranslation = false)

Get the Imu To Camera Extrinsics object from the data loaded if there is a linked connection between IMU and the given camera then there relative rotation and translation from the IMU to Camera is returned.

Matrix representation of transformation matrix

\[\begin{split} \text{Transformation Matrix} = \left [ \begin{matrix} r_{00} & r_{01} & r_{02} & T_x \\ r_{10} & r_{11} & r_{12} & T_y \\ r_{20} & r_{21} & r_{22} & T_z \\ 0 & 0 & 0 & 1 \end{matrix} \right ] \end{split}\]
Return

Returns a transformationMatrix which is 4x4 in homogenious coordinate system

Parameters
  • cameraId: Camera Id of the camera which will be considerd as destination. To which Transformation matrix from the IMU will be found.

  • useSpecTranslation: Enabling this bool uses the translation information from the board design data

std::vector<std::vector<float>> getStereoRightRectificationRotation()

Get the Stereo Right Rectification Rotation object

Return

returns a 3x3 rectification rotation matrix

std::vector<std::vector<float>> getStereoLeftRectificationRotation()

Get the Stereo Left Rectification Rotation object

Return

returns a 3x3 rectification rotation matrix

dai::CameraBoardSocket getStereoLeftCameraId()

Get the camera id of the camera which is used as left camera of the stereo setup

Return

cameraID of the camera used as left camera

dai::CameraBoardSocket getStereoRightCameraId()

Get the camera id of the camera which is used as right camera of the stereo setup

Return

cameraID of the camera used as right camera

bool eepromToJsonFile(std::string destPath) const

Write raw calibration/board data to json file.

Return

True on success, false otherwise

Parameters
  • destPath: Full path to the json file in which raw calibration data will be stored

void setBoardInfo(std::string boardName, std::string boardRev)

Set the Board Info object

Parameters
  • version: Sets the version of the Calibration data(Current version is 6)

  • boardName: Sets your board name.

  • boardRev: set your board revision id.

void setCameraIntrinsics(CameraBoardSocket cameraId, std::vector<std::vector<float>> intrinsics, Size2f frameSize)

Set the Camera Intrinsics object

Matrix representation of intrinsic matrix

\[\begin{split} \text{Intrinsic Matrix} = \left [ \begin{matrix} f_x & 0 & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{matrix} \right ] \end{split}\]
Parameters
  • cameraId: CameraId of the camera for which Camera intrinsics are being loaded

  • intrinsics: 3x3 intrinsics matrix

  • frameSize: repesents the width and height of the image at which intrinsics are calculated.

void setCameraIntrinsics(CameraBoardSocket cameraId, std::vector<std::vector<float>> intrinsics, int width, int height)

Set the Camera Intrinsics object

Matrix representation of intrinsic matrix

\[\begin{split} \text{Intrinsic Matrix} = \left [ \begin{matrix} f_x & 0 & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{matrix} \right ] \end{split}\]
Parameters
  • cameraId: CameraId of the camera for which Camera intrinsics are being loaded

  • intrinsics: 3x3 intrinsics matrix

  • width: repesents the width of the image at which intrinsics are calculated.

  • height: repesents the height of the image at which intrinsics are calculated.

void setCameraIntrinsics(CameraBoardSocket cameraId, std::vector<std::vector<float>> intrinsics, std::tuple<int, int> frameSize)

Set the Camera Intrinsics object

Matrix representation of intrinsic matrix

\[\begin{split} \text{Intrinsic Matrix} = \left [ \begin{matrix} f_x & 0 & c_x \\ 0 & f_y & c_y \\ 0 & 0 & 1 \end{matrix} \right ] \end{split}\]
Parameters
  • cameraId: CameraId of the camera for which Camera intrinsics are being loaded

  • intrinsics: 3x3 intrinsics matrix

  • frameSize: repesents the width and height of the image at which intrinsics are calculated.

void setDistortionCoefficients(CameraBoardSocket cameraId, std::vector<float> distortionCoefficients)

Sets the distortion Coefficients obtained from camera calibration

Parameters
  • cameraId: Camera Id of the camera for which distoriton coefficients are computed

  • distortionCoefficients: Distortion Coefficients of the respective Camera.

void setFov(CameraBoardSocket cameraId, float hfov)

Set the Fov of the Camera

Parameters
  • cameraId: Camera Id of the camera

  • hfov: Horizontal fov of the camera from Camera Datasheet

void setLensPosition(CameraBoardSocket cameraId, uint8_t lensPosition)

Sets the distortion Coefficients obtained from camera calibration

Parameters
  • cameraId: Camera Id of the camera

  • lensPosition: lens posiotion value of the camera at the time of calibration

void setCameraType(CameraBoardSocket cameraId, CameraModel cameraModel)

Set the Camera Type object

Parameters
  • cameraId: CameraId of the camera for which cameraModel Type is being updated.

  • cameraModel: Type of the model the camera represents

void setCameraExtrinsics(CameraBoardSocket srcCameraId, CameraBoardSocket destCameraId, std::vector<std::vector<float>> rotationMatrix, std::vector<float> translation, std::vector<float> specTranslation = {0, 0, 0})

Set the Camera Extrinsics object

Parameters
  • srcCameraId: Camera Id of the camera which will be considerd as relative origin.

  • destCameraId: Camera Id of the camera which will be considerd as destination from srcCameraId.

  • rotationMatrix: Rotation between srcCameraId and destCameraId origins.

  • translation: Translation between srcCameraId and destCameraId origins.

  • specTranslation: Translation between srcCameraId and destCameraId origins from the design.

void setImuExtrinsics(CameraBoardSocket destCameraId, std::vector<std::vector<float>> rotationMatrix, std::vector<float> translation, std::vector<float> specTranslation = {0, 0, 0})

Set the Imu to Camera Extrinsics object

Parameters
  • destCameraId: Camera Id of the camera which will be considerd as destination from IMU.

  • rotationMatrix: Rotation between srcCameraId and destCameraId origins.

  • translation: Translation between IMU and destCameraId origins.

  • specTranslation: Translation between IMU and destCameraId origins from the design.

void setStereoLeft(CameraBoardSocket cameraId, std::vector<std::vector<float>> rectifiedRotation)

Set the Stereo Left Rectification object

Homography of the Left Rectification = Intrinsics_right * rectifiedRotation * inv(Intrinsics_left)

Parameters
  • cameraId: CameraId of the camera which will be used as left Camera of stereo Setup

  • rectifiedRotation: Rectification rotation of the left camera required for feature matching

void setStereoRight(CameraBoardSocket cameraId, std::vector<std::vector<float>> rectifiedRotation)

Set the Stereo Right Rectification object

Homography of the Right Rectification = Intrinsics_right * rectifiedRotation * inv(Intrinsics_right)

Parameters
  • cameraId: CameraId of the camera which will be used as left Camera of stereo Setup

  • rectifiedRotation: Rectification rotation of the left camera required for feature matching

bool validateCameraArray()

Using left camera as the head it iterates over the camera extrinsics connection to check if all the camera extrinsics are connected and no loop exists.

Return

true on proper connection with no loops.

class CallbackHandler
class CameraControl : public dai::Buffer
#include <CameraControl.hpp>

CameraControl message. Specifies various camera control commands like:

  • Still capture

  • Auto focus

  • Anti banding

  • Auto white balance

  • Scene

  • Effect

Public Functions

CameraControl()

Construct CameraControl message.

void setCaptureStill(bool capture)

Set a command to capture a still image

void setStartStreaming()

Set a command to start streaming

void setStopStreaming()

Set a command to stop streaming

void setAutoFocusMode(AutoFocusMode mode)

Set a command to specify autofocus mode

void setAutoFocusTrigger()

Set a command to trigger autofocus

void setAutoFocusRegion(uint16_t startX, uint16_t startY, uint16_t width, uint16_t height)

Set a command to specify focus region in pixels

Parameters
  • startX: X coordinate of top left corner of region

  • startY: Y coordinate of top left corner of region

  • width: Region width

  • height: Region height

void setManualFocus(uint8_t lensPosition)

Set a command to specify manual focus position

Parameters
  • lensPosition: specify lens position 0..255

void setAutoExposureEnable()

Set a command to enable auto exposure

void setAutoExposureLock(bool lock)

Set a command to specify lock auto exposure

Parameters
  • lock: Auto exposure lock mode enabled or disabled

void setAutoExposureRegion(uint16_t startX, uint16_t startY, uint16_t width, uint16_t height)

Set a command to specify auto exposure region in pixels

Parameters
  • startX: X coordinate of top left corner of region

  • startY: Y coordinate of top left corner of region

  • width: Region width

  • height: Region height

void setAutoExposureCompensation(int compensation)

Set a command to specify auto exposure compensation

Parameters
  • compensation: Compensation value between -9..9

void setAntiBandingMode(AntiBandingMode mode)

Set a command to specify auto banding mode

Parameters
  • mode: Auto banding mode to use

void setManualExposure(uint32_t exposureTimeUs, uint32_t sensitivityIso)

Set a command to manually specify exposure

Parameters
  • exposureTimeUs: Exposure time in microseconds

  • sensitivityIso: Sensitivity as ISO value, usual range 100..1600

void setAutoWhiteBalanceMode(AutoWhiteBalanceMode mode)

Set a command to specify auto white balance mode

Parameters
  • mode: Auto white balance mode to use

void setAutoWhiteBalanceLock(bool lock)

Set a command to specify auto white balance lock

Parameters
  • lock: Auto white balance lock mode enabled or disabled

void setManualWhiteBalance(int colorTemperatureK)

Set a command to manually specify white-balance color correction

Parameters
  • colorTemperatureK: Light source color temperature in kelvins, range 1000..12000

void setBrightness(int value)

Set a command to adjust image brightness

Parameters
  • value: Brightness, range -10..10

void setContrast(int value)

Set a command to adjust image contrast

Parameters
  • value: Contrast, range -10..10

void setSaturation(int value)

Set a command to adjust image saturation

Parameters
  • value: Saturation, range -10..10

void setSharpness(int value)

Set a command to adjust image sharpness

Parameters
  • value: Sharpness, range 0..4

void setLumaDenoise(int value)

Set a command to adjust luma denoise amount

Parameters
  • value: Luma denoise amount, range 0..4

void setChromaDenoise(int value)

Set a command to adjust chroma denoise amount

Parameters
  • value: Chroma denoise amount, range 0..4

void setSceneMode(SceneMode mode)

Set a command to specify scene mode

Parameters
  • mode: Scene mode

void setEffectMode(EffectMode mode)

Set a command to specify effect mode

Parameters
  • mode: Effect mode

bool getCaptureStill() const

Check whether command to capture a still is set

Return

True if capture still command is set

struct CameraInfo
#include <CameraInfo.hpp>

CameraInfo structure.

struct ChipTemperature
#include <ChipTemperature.hpp>

Chip temperature information.

Multiple temperature measurement points and their average

Public Members

float css

CPU Subsystem

float mss

Media Subsystem

float upa

Shave Array

float dss

DRAM Subsystem

float average

Average of measurements

struct ColorCameraProperties
#include <ColorCameraProperties.hpp>

Specify properties for ColorCamera such as camera ID, …

Public Types

enum SensorResolution

Select the camera sensor resolution

Values:

enumerator THE_1080_P
enumerator THE_4_K
enumerator THE_12_MP
enumerator THE_13_MP
enum ColorOrder

For 24 bit color these can be either RGB or BGR

Values:

enumerator BGR
enumerator RGB

Public Members

CameraBoardSocket boardSocket = CameraBoardSocket::AUTO

Which socket will color camera use

CameraImageOrientation imageOrientation = CameraImageOrientation::AUTO

Camera sensor image orientation / pixel readout

ColorOrder colorOrder = ColorOrder::BGR

For 24 bit color these can be either RGB or BGR

bool interleaved = true

Are colors interleaved (R1G1B1, R2G2B2, …) or planar (R1R2…, G1G2…, B1B2)

bool fp16 = false

Are values FP16 type (0.0 - 255.0)

uint32_t previewHeight = 300

Preview frame output height

uint32_t previewWidth = 300

Preview frame output width

int32_t videoWidth = AUTO

Preview frame output width

int32_t videoHeight = AUTO

Preview frame output height

int32_t stillWidth = AUTO

Preview frame output width

int32_t stillHeight = AUTO

Preview frame output height

SensorResolution resolution = SensorResolution::THE_1080_P

Select the camera sensor resolution

float fps = 30.0

Camera sensor FPS

float sensorCropX = AUTO

Initial sensor crop, -1 signifies center crop

bool inputConfigSync = false

Whether to wait for config at ‘inputConfig’ io

bool previewKeepAspectRatio = true

Whether to keep aspect ratio of input (video size) or not

IspScale ispScale

Configure scaling for isp output.

struct IspScale
struct CpuUsage
#include <CpuUsage.hpp>

CpuUsage structure

Average usage in percent and time span of the average (since last query)

Public Members

float average

Average CPU usage, expressed with a normalized value (0-1)

int32_t msTime

Time span in which the average was calculated in milliseconds

class DataInputQueue
#include <DataQueue.hpp>

Access to send messages through XLink stream

Public Functions

bool isClosed() const

Check whether queue is closed

void close()

Closes the queue and the underlying thread

void setMaxDataSize(std::size_t maxSize)

Sets maximum message size. If message is larger than specified, then an exception is issued.

Parameters
  • maxSize: Maximum message size to add to queue

std::size_t getMaxDataSize()

Gets maximum queue size.

Return

Maximum message size

void setBlocking(bool blocking)

Sets queue behavior when full (maxSize)

Parameters
  • blocking: Specifies if block or overwrite the oldest message in the queue

bool getBlocking() const

Gets current queue behavior when full (maxSize)

Return

True if blocking, false otherwise

void setMaxSize(unsigned int maxSize)

Sets queue maximum size

Parameters
  • maxSize: Specifies maximum number of messages in the queue

unsigned int getMaxSize() const

Gets queue maximum size

Return

Maximum queue size

std::string getName() const

Gets queues name

Return

Queue name

void send(const std::shared_ptr<RawBuffer> &rawMsg)

Adds a raw message to the queue, which will be picked up and sent to the device. Can either block if ‘blocking’ behavior is true or overwrite oldest

Parameters
  • rawMsg: Message to add to the queue

void send(const std::shared_ptr<ADatatype> &msg)

Adds a message to the queue, which will be picked up and sent to the device. Can either block if ‘blocking’ behavior is true or overwrite oldest

Parameters
  • msg: Message to add to the queue

void send(const ADatatype &msg)

Adds a message to the queue, which will be picked up and sent to the device. Can either block if ‘blocking’ behavior is true or overwrite oldest

Parameters
  • msg: Message to add to the queue

bool send(const std::shared_ptr<RawBuffer> &rawMsg, std::chrono::milliseconds timeout)

Adds message to the queue, which will be picked up and sent to the device. Can either block until timeout if ‘blocking’ behavior is true or overwrite oldest

Parameters
  • rawMsg: Message to add to the queue

  • timeout: Maximum duration to block in milliseconds

bool send(const std::shared_ptr<ADatatype> &msg, std::chrono::milliseconds timeout)

Adds message to the queue, which will be picked up and sent to the device. Can either block until timeout if ‘blocking’ behavior is true or overwrite oldest

Parameters
  • msg: Message to add to the queue

  • timeout: Maximum duration to block in milliseconds

bool send(const ADatatype &msg, std::chrono::milliseconds timeout)

Adds message to the queue, which will be picked up and sent to the device. Can either block until timeout if ‘blocking’ behavior is true or overwrite oldest

Parameters
  • msg: Message to add to the queue

  • timeout: Maximum duration to block in milliseconds

class DataOutputQueue
#include <DataQueue.hpp>

Access to receive messages coming from XLink stream

Public Types

using CallbackId = int

Alias for callback id.

Public Functions

bool isClosed() const

Check whether queue is closed

void close()

Closes the queue and the underlying thread

void setBlocking(bool blocking)

Sets queue behavior when full (maxSize)

Parameters
  • blocking: Specifies if block or overwrite the oldest message in the queue

bool getBlocking() const

Gets current queue behavior when full (maxSize)

Return

True if blocking, false otherwise

void setMaxSize(unsigned int maxSize)

Sets queue maximum size

Parameters
  • maxSize: Specifies maximum number of messages in the queue

unsigned int getMaxSize() const

Gets queue maximum size

Return

Maximum queue size

std::string getName() const

Gets queues name

Return

Queue name

CallbackId addCallback(std::function<void(std::string, std::shared_ptr<ADatatype>)>)

Adds a callback on message received

Return

Callback id

Parameters
  • callback: Callback function with queue name and message pointer

CallbackId addCallback(std::function<void(std::shared_ptr<ADatatype>)>)

Adds a callback on message received

Return

Callback id

Parameters
  • callback: Callback function with message pointer

CallbackId addCallback(std::function<void()> callback)

Adds a callback on message received

Return

Callback id

Parameters
  • callback: Callback function without any parameters

bool removeCallback(CallbackId callbackId)

Removes a callback

Return

True if callback was removed, false otherwise

Parameters
  • callbackId: Id of callback to be removed

template<class T>
bool has()

Check whether front of the queue has message of type T

Return

True if queue isn’t empty and the first element is of type T, false otherwise

bool has()

Check whether front of the queue has a message (isn’t empty)

Return

True if queue isn’t empty, false otherwise

template<class T>
std::shared_ptr<T> tryGet()

Try to retrieve message T from queue. If message isn’t of type T it returns nullptr

Return

Message of type T or nullptr if no message available

std::shared_ptr<ADatatype> tryGet()

Try to retrieve message from queue. If no message available, return immidiately with nullptr

Return

Message or nullptr if no message available

template<class T>
std::shared_ptr<T> get()

Block until a message is available.

Return

Message of type T or nullptr if no message available

std::shared_ptr<ADatatype> get()

Block until a message is available.

Return

Message or nullptr if no message available

template<class T>
std::shared_ptr<T> front()

Gets first message in the queue.

Return

Message of type T or nullptr if no message available

std::shared_ptr<ADatatype> front()

Gets first message in the queue.

Return

Message or nullptr if no message available

template<class T, typename Rep, typename Period>
std::shared_ptr<T> get(std::chrono::duration<Rep, Period> timeout, bool &hasTimedout)

Block until a message is available with a timeout.

Return

Message of type T otherwise nullptr if message isn’t type T or timeout occured

Parameters
  • timeout: Duration for which the function should block

  • [out] hasTimedout: Outputs true if timeout occured, false otherwise

template<typename Rep, typename Period>
std::shared_ptr<ADatatype> get(std::chrono::duration<Rep, Period> timeout, bool &hasTimedout)

Block until a message is available with a timeout.

Return

Message of type T otherwise nullptr if message isn’t type T or timeout occured

Parameters
  • timeout: Duration for which the function should block

  • [out] hasTimedout: Outputs true if timeout occured, false otherwise

template<class T>
std::vector<std::shared_ptr<T>> tryGetAll()

Try to retrieve all messages in the queue.

Return

Vector of messages which can either be of type T or nullptr

std::vector<std::shared_ptr<ADatatype>> tryGetAll()

Try to retrieve all messages in the queue.

Return

Vector of messages

template<class T>
std::vector<std::shared_ptr<T>> getAll()

Block until at least one message in the queue. Then return all messages from the queue.

Return

Vector of messages which can either be of type T or nullptr

std::vector<std::shared_ptr<ADatatype>> getAll()

Block until at least one message in the queue. Then return all messages from the queue.

Return

Vector of messages

template<class T, typename Rep, typename Period>
std::vector<std::shared_ptr<T>> getAll(std::chrono::duration<Rep, Period> timeout, bool &hasTimedout)

Block for maximum timeout duration. Then return all messages from the queue.

Return

Vector of messages which can either be of type T or nullptr

Parameters
  • timeout: Maximum duration to block

  • [out] hasTimedout: Outputs true if timeout occured, false otherwise

template<typename Rep, typename Period>
std::vector<std::shared_ptr<ADatatype>> getAll(std::chrono::duration<Rep, Period> timeout, bool &hasTimedout)

Block for maximum timeout duration. Then return all messages from the queue.

Return

Vector of messages

Parameters
  • timeout: Maximum duration to block

  • [out] hasTimedout: Outputs true if timeout occured, false otherwise

struct DetectionNetworkProperties : public dai::NeuralNetworkProperties
#include <DetectionNetworkProperties.hpp>

Specify properties for DetectionNetwork

Subclassed by dai::SpatialDetectionNetworkProperties

Public Members

DetectionNetworkType nnFamily

Generic Neural Network properties.

int classes

YOLO specific network properties.

class Device : public dai::DeviceBase
#include <Device.hpp>

Represents the DepthAI device with the methods to interact with it. Implements the host-side queues to connect with XLinkIn and XLinkOut nodes

Public Functions

Device(const Pipeline &pipeline)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • pipeline: Pipeline to be executed on the device

Device(const Pipeline &pipeline, bool usb2Mode)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • pipeline: Pipeline to be executed on the device

  • usb2Mode: Boot device using USB2 mode firmware

Device(const Pipeline &pipeline, UsbSpeed maxUsbSpeed)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • pipeline: Pipeline to be executed on the device

  • maxUsbSpeed: Maximum allowed USB speed

Device(const Pipeline &pipeline, const char *pathToCmd)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • pipeline: Pipeline to be executed on the device

  • pathToCmd: Path to custom device firmware

Device(const Pipeline &pipeline, const std::string &pathToCmd)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • pipeline: Pipeline to be executed on the device

  • pathToCmd: Path to custom device firmware

Device(const Pipeline &pipeline, const DeviceInfo &devInfo)

Connects to device specified by devInfo.

Parameters
  • pipeline: Pipeline to be executed on the device

  • devInfo: DeviceInfo which specifies which device to connect to

Device(const Pipeline &pipeline, const DeviceInfo &devInfo, bool usb2Mode)

Connects to device specified by devInfo.

Parameters
  • pipeline: Pipeline to be executed on the device

  • devInfo: DeviceInfo which specifies which device to connect to

  • usb2Mode: Boot device using USB2 mode firmware

Device(const Pipeline &pipeline, const DeviceInfo &devInfo, UsbSpeed maxUsbSpeed)

Connects to device specified by devInfo.

Parameters
  • pipeline: Pipeline to be executed on the device

  • devInfo: DeviceInfo which specifies which device to connect to

  • maxUsbSpeed: Maximum allowed USB speed

Device(const Pipeline &pipeline, const DeviceInfo &devInfo, const char *pathToCmd)

Connects to device specified by devInfo.

Parameters
  • pipeline: Pipeline to be executed on the device

  • devInfo: DeviceInfo which specifies which device to connect to

  • pathToCmd: Path to custom device firmware

Device(const Pipeline &pipeline, const DeviceInfo &devInfo, const std::string &pathToCmd)

Connects to device specified by devInfo.

Parameters
  • pipeline: Pipeline to be executed on the device

  • devInfo: DeviceInfo which specifies which device to connect to

  • pathToCmd: Path to custom device firmware

Device()

Connects to any available device with a DEFAULT_SEARCH_TIME timeout. Uses OpenVINO version Pipeline::DEFAULT_OPENVINO_VERSION

~Device() override

dtor to close the device

std::shared_ptr<DataOutputQueue> getOutputQueue(const std::string &name)

Gets an output queue corresponding to stream name. If it doesn’t exist it throws

Return

Smart pointer to DataOutputQueue

Parameters
  • name: Queue/stream name, created by XLinkOut node

std::shared_ptr<DataOutputQueue> getOutputQueue(const std::string &name, unsigned int maxSize, bool blocking = true)

Gets a queue corresponding to stream name, if it exists, otherwise it throws. Also sets queue options

Return

Smart pointer to DataOutputQueue

Parameters
  • name: Queue/stream name, set in XLinkOut node

  • maxSize: Maximum number of messages in queue

  • blocking: Queue behavior once full. True specifies blocking and false overwriting of oldest messages. Default: true

std::vector<std::string> getOutputQueueNames() const

Get all available output queue names

Return

Vector of output queue names

std::shared_ptr<DataInputQueue> getInputQueue(const std::string &name)

Gets an input queue corresponding to stream name. If it doesn’t exist it throws

Return

Smart pointer to DataInputQueue

Parameters
  • name: Queue/stream name, set in XLinkIn node

std::shared_ptr<DataInputQueue> getInputQueue(const std::string &name, unsigned int maxSize, bool blocking = true)

Gets an input queue corresponding to stream name. If it doesn’t exist it throws. Also sets queue options

Return

Smart pointer to DataInputQueue

Parameters
  • name: Queue/stream name, set in XLinkOut node

  • maxSize: Maximum number of messages in queue

  • blocking: Queue behavior once full. True: blocking, false: overwriting of oldest messages. Default: true

std::vector<std::string> getInputQueueNames() const

Get all available input queue names

Return

Vector of input queue names

std::vector<std::string> getQueueEvents(const std::vector<std::string> &queueNames, std::size_t maxNumEvents = std::numeric_limits<std::size_t>::max(), std::chrono::microseconds timeout = std::chrono::microseconds(-1))

Gets or waits until any of specified queues has received a message

Return

Names of queues which received messages first

Parameters
  • queueNames: Names of queues for which to block

  • maxNumEvents: Maximum number of events to remove from queue - Default is unlimited

  • timeout: Timeout after which return regardless. If negative then wait is indefinite - Default is -1

std::vector<std::string> getQueueEvents(std::string queueName, std::size_t maxNumEvents = std::numeric_limits<std::size_t>::max(), std::chrono::microseconds timeout = std::chrono::microseconds(-1))

Gets or waits until specified queue has received a message

Return

Names of queues which received messages first

Parameters
  • queueName: Name of queues for which to wait for

  • maxNumEvents: Maximum number of events to remove from queue. Default is unlimited

  • timeout: Timeout after which return regardless. If negative then wait is indefinite. Default is -1

std::vector<std::string> getQueueEvents(std::size_t maxNumEvents = std::numeric_limits<std::size_t>::max(), std::chrono::microseconds timeout = std::chrono::microseconds(-1))

Gets or waits until any any queue has received a message

Return

Names of queues which received messages first

Parameters
  • maxNumEvents: Maximum number of events to remove from queue. Default is unlimited

  • timeout: Timeout after which return regardless. If negative then wait is indefinite. Default is -1

std::string getQueueEvent(const std::vector<std::string> &queueNames, std::chrono::microseconds timeout = std::chrono::microseconds(-1))

Gets or waits until any of specified queues has received a message

Return

Queue name which received a message first

Parameters
  • queueNames: Names of queues for which to wait for

  • timeout: Timeout after which return regardless. If negative then wait is indefinite. Default is -1

std::string getQueueEvent(std::string queueName, std::chrono::microseconds timeout = std::chrono::microseconds(-1))

Gets or waits until specified queue has received a message

Return

Queue name which received a message

Parameters
  • queueNames: Name of queues for which to wait for

  • timeout: Timeout after which return regardless. If negative then wait is indefinite. Default is -1

std::string getQueueEvent(std::chrono::microseconds timeout = std::chrono::microseconds(-1))

Gets or waits until any queue has received a message

Return

Queue name which received a message

Parameters
  • timeout: Timeout after which return regardless. If negative then wait is indefinite. Default is -1

Public Static Attributes

constexpr std::size_t EVENT_QUEUE_MAXIMUM_SIZE = {2048}

Maximum number of elements in event queue.

class DeviceBase
#include <DeviceBase.hpp>

The core of depthai device for RAII, connects to device and maintains watchdog, timesync, …

Subclassed by dai::Device

Public Functions

DeviceBase(const Pipeline &pipeline)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • pipeline: Pipeline to be executed on the device

DeviceBase(const Pipeline &pipeline, bool usb2Mode)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • pipeline: Pipeline to be executed on the device

  • usb2Mode: Boot device using USB2 mode firmware

DeviceBase(const Pipeline &pipeline, UsbSpeed maxUsbSpeed)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • pipeline: Pipeline to be executed on the device

  • maxUsbSpeed: Maximum allowed USB speed

DeviceBase(const Pipeline &pipeline, const char *pathToCmd)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • pipeline: Pipeline to be executed on the device

  • pathToCmd: Path to custom device firmware

DeviceBase(const Pipeline &pipeline, const std::string &pathToCmd)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • pipeline: Pipeline to be executed on the device

  • pathToCmd: Path to custom device firmware

DeviceBase(const Pipeline &pipeline, const DeviceInfo &devInfo)

Connects to device specified by devInfo.

Parameters
  • pipeline: Pipeline to be executed on the device

  • devInfo: DeviceInfo which specifies which device to connect to

DeviceBase(const Pipeline &pipeline, const DeviceInfo &devInfo, bool usb2Mode)

Connects to device specified by devInfo.

Parameters
  • pipeline: Pipeline to be executed on the device

  • devInfo: DeviceInfo which specifies which device to connect to

  • usb2Mode: Boot device using USB2 mode firmware

DeviceBase(const Pipeline &pipeline, const DeviceInfo &devInfo, UsbSpeed maxUsbSpeed)

Connects to device specified by devInfo.

Parameters
  • pipeline: Pipeline to be executed on the device

  • devInfo: DeviceInfo which specifies which device to connect to

  • maxUsbSpeed: Maximum allowed USB speed

DeviceBase(const Pipeline &pipeline, const DeviceInfo &devInfo, const char *pathToCmd)

Connects to device specified by devInfo.

Parameters
  • pipeline: Pipeline to be executed on the device

  • devInfo: DeviceInfo which specifies which device to connect to

  • pathToCmd: Path to custom device firmware

DeviceBase(const Pipeline &pipeline, const DeviceInfo &devInfo, const std::string &pathToCmd)

Connects to device specified by devInfo.

Parameters
  • pipeline: Pipeline to be executed on the device

  • devInfo: DeviceInfo which specifies which device to connect to

  • pathToCmd: Path to custom device firmware

DeviceBase()

Connects to any available device with a DEFAULT_SEARCH_TIME timeout. Uses OpenVINO version Pipeline::DEFAULT_OPENVINO_VERSION

DeviceBase(OpenVINO::Version version)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • version: OpenVINO version which the device will be booted with.

DeviceBase(OpenVINO::Version version, bool usb2Mode)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • version: OpenVINO version which the device will be booted with

  • usb2Mode: Boot device using USB2 mode firmware

DeviceBase(OpenVINO::Version version, UsbSpeed maxUsbSpeed)

Connects to device specified by devInfo.

Parameters
  • version: OpenVINO version which the device will be booted with

  • devInfo: DeviceInfo which specifies which device to connect to

  • maxUsbSpeed: Maximum allowed USB speed

DeviceBase(OpenVINO::Version version, const char *pathToCmd)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • version: OpenVINO version which the device will be booted with

  • pathToCmd: Path to custom device firmware

DeviceBase(OpenVINO::Version version, const std::string &pathToCmd)

Connects to any available device with a DEFAULT_SEARCH_TIME timeout.

Parameters
  • version: OpenVINO version which the device will be booted with

  • pathToCmd: Path to custom device firmware

DeviceBase(OpenVINO::Version version, const DeviceInfo &devInfo)

Connects to device specified by devInfo.

Parameters
  • version: OpenVINO version which the device will be booted with

  • devInfo: DeviceInfo which specifies which device to connect to

DeviceBase(OpenVINO::Version version, const DeviceInfo &devInfo, bool usb2Mode)

Connects to device specified by devInfo.

Parameters
  • version: OpenVINO version which the device will be booted with

  • devInfo: DeviceInfo which specifies which device to connect to

  • usb2Mode: Boot device using USB2 mode firmware

DeviceBase(OpenVINO::Version version, const DeviceInfo &devInfo, UsbSpeed maxUsbSpeed)

Connects to device specified by devInfo.

Parameters
  • version: OpenVINO version which the device will be booted with

  • devInfo: DeviceInfo which specifies which device to connect to

  • maxUsbSpeed: Maximum allowed USB speed

DeviceBase(OpenVINO::Version version, const DeviceInfo &devInfo, const char *pathToCmd)

Connects to device specified by devInfo.

Parameters
  • version: OpenVINO version which the device will be booted with

  • devInfo: DeviceInfo which specifies which device to connect to

  • pathToCmd: Path to custom device firmware

DeviceBase(OpenVINO::Version version, const DeviceInfo &devInfo, const std::string &pathToCmd)

Connects to device specified by devInfo.

Parameters
  • version: OpenVINO version which the device will be booted with

  • devInfo: DeviceInfo which specifies which device to connect to

  • usb2Mode: Path to custom device firmware

DeviceBase(Config config)

Connects to any available device with custom config.

Parameters
  • config: Device custom configuration to boot with

DeviceBase(Config config, const DeviceInfo &devInfo)

Connects to device ‘devInfo’ with custom config.

Parameters
  • devInfo: DeviceInfo which specifies which device to connect to

  • config: Device custom configuration to boot with

~DeviceBase()

Device destructor

Note

In the destructor of the derived class, remember to call close()

bool isPipelineRunning()

Checks if devices pipeline is already running

Return

True if running, false otherwise

bool startPipeline()

Starts the execution of the devices pipeline

Return

True if pipeline started, false otherwise

bool startPipeline(const Pipeline &pipeline)

Starts the execution of a given pipeline

Return

True if pipeline started, false otherwise

Parameters
  • pipeline: OpenVINO version of the pipeline must match the one which the device was booted with.

void setLogLevel(LogLevel level)

Sets the devices logging severity level. This level affects which logs are transfered from device to host.

Parameters
  • level: Logging severity

LogLevel getLogLevel()

Gets current logging severity level of the device.

Return

Logging severity level

void setXLinkChunkSize(int sizeBytes)

Sets the chunk size for splitting device-sent XLink packets. A larger value could increase performance, and 0 disables chunking. A negative value is ignored. Device defaults are configured per protocol, currently 64*1024 for both USB and Ethernet.

Parameters
  • sizeBytes: XLink chunk size in bytes

int getXLinkChunkSize()

Gets current XLink chunk size.

Return

XLink chunk size in bytes

DeviceInfo getDeviceInfo() const

Get the Device Info object o the device which is currently running

Return

DeviceInfo of the current device in execution

std::string getMxId()

Get MxId of device

Return

MxId of connected device

void setLogOutputLevel(LogLevel level)

Sets logging level which decides printing level to standard output. If lower than setLogLevel, no messages will be printed

Parameters
  • level: Standard output printing severity

LogLevel getLogOutputLevel()

Gets logging level which decides printing level to standard output.

Return

Standard output printing severity

int addLogCallback(std::function<void(LogMessage)> callback)

Add a callback for device logging. The callback will be called from a separate thread with the LogMessage being passed.

Return

Id which can be used to later remove the callback

Parameters
  • callback: Callback to call whenever a log message arrives

bool removeLogCallback(int callbackId)

Removes a callback

Return

True if callback was removed, false otherwise

Parameters
  • callbackId: Id of callback to be removed

void setSystemInformationLoggingRate(float rateHz)

Sets rate of system information logging (“info” severity). Default 1Hz If parameter is less or equal to zero, then system information logging will be disabled

Parameters
  • rateHz: Logging rate in Hz

float getSystemInformationLoggingRate()

Gets current rate of system information logging (“info” severity) in Hz.

Return

Logging rate in Hz

std::vector<CameraBoardSocket> getConnectedCameras()

Get cameras that are connected to the device

Return

Vector of connected cameras

std::unordered_map<CameraBoardSocket, std::string> getCameraSensorNames()

Get sensor names for cameras that are connected to the device

Return

Map/dictionary with camera sensor names, indexed by socket

MemoryInfo getDdrMemoryUsage()

Retrieves current DDR memory information from device

Return

Used, remaining and total ddr memory

MemoryInfo getCmxMemoryUsage()

Retrieves current CMX memory information from device

Return

Used, remaining and total cmx memory

MemoryInfo getLeonCssHeapUsage()

Retrieves current CSS Leon CPU heap information from device

Return

Used, remaining and total heap memory

MemoryInfo getLeonMssHeapUsage()

Retrieves current MSS Leon CPU heap information from device

Return

Used, remaining and total heap memory

ChipTemperature getChipTemperature()

Retrieves current chip temperature as measured by device

Return

Temperature of various onboard sensors

CpuUsage getLeonCssCpuUsage()

Retrieves average CSS Leon CPU usage

Return

Average CPU usage and sampling duration

CpuUsage getLeonMssCpuUsage()

Retrieves average MSS Leon CPU usage

Return

Average CPU usage and sampling duration

bool flashCalibration(CalibrationHandler calibrationDataHandler)

Stores the Calibration and Device information to the Device EEPROM

Return

true on successful flash, false on failure

Parameters

CalibrationHandler readCalibration()

Fetches the EEPROM data from the device and loads it into CalibrationHandler object

Return

The CalibrationHandler object containing the calibration currently flashed on device EEPROM

UsbSpeed getUsbSpeed()

Retrieves USB connection speed

Return

USB connection speed of connected device if applicable. Unknown otherwise.

void close()

Explicitly closes connection to device.

Note

This function does not need to be explicitly called as destructor closes the device automatically

bool isClosed() const

Is the device already closed (or disconnected)

std::shared_ptr<XLinkConnection> getConnection()

Returns underlying XLinkConnection

std::shared_ptr<const XLinkConnection> getConnection() const

Returns underlying XLinkConnection

Public Static Functions

template<typename Rep, typename Period>
std::tuple<bool, DeviceInfo> getAnyAvailableDevice(std::chrono::duration<Rep, Period> timeout)

Waits for any available device with a timeout

Return

Tuple of bool and DeviceInfo. Bool specifies if device was found. DeviceInfo specifies the found device

Parameters
  • timeout: duration of time to wait for the any device

std::tuple<bool, DeviceInfo> getAnyAvailableDevice()

Gets any available device

Return

Tuple of bool and DeviceInfo. Bool specifies if device was found. DeviceInfo specifies the found device

std::tuple<bool, DeviceInfo> getFirstAvailableDevice()

Gets first available device. Device can be either in XLINK_UNBOOTED or XLINK_BOOTLOADER state

Return

Tuple of bool and DeviceInfo. Bool specifies if device was found. DeviceInfo specifies the found device

std::tuple<bool, DeviceInfo> getDeviceByMxId(std::string mxId)

Finds a device by MX ID. Example: 14442C10D13EABCE00

Return

Tuple of bool and DeviceInfo. Bool specifies if device was found. DeviceInfo specifies the found device

Parameters
  • mxId: MyraidX ID which uniquely specifies a device

std::vector<DeviceInfo> getAllAvailableDevices()

Returns all connected devices

Return

Vector of connected devices

std::vector<std::uint8_t> getEmbeddedDeviceBinary(bool usb2Mode, OpenVINO::Version version = OpenVINO::DEFAULT_VERSION)

Gets device firmware binary for a specific OpenVINO version

Return

Firmware binary

Parameters
  • usb2Mode: USB2 mode firmware

  • version: Version of OpenVINO which firmware will support

std::vector<std::uint8_t> getEmbeddedDeviceBinary(Config config)

Gets device firmware binary for a specific configuration

Return

Firmware binary

Parameters
  • config: FW with applied configuration

Public Static Attributes

constexpr std::chrono::seconds DEFAULT_SEARCH_TIME = {3}

Default search time for constructors which discover devices.

constexpr float DEFAULT_SYSTEM_INFORMATION_LOGGING_RATE_HZ = {1.0f}

Default rate at which system information is logged.

constexpr UsbSpeed DEFAULT_USB_SPEED = {UsbSpeed::SUPER}

Default UsbSpeed for device connection.

struct Config
#include <DeviceBase.hpp>

Device specific configuration

class DeviceBootloader
#include <DeviceBootloader.hpp>

Represents the DepthAI bootloader with the methods to interact with it.

Public Functions

DeviceBootloader(const DeviceInfo &devInfo, bool allowFlashingBootloader = false)

Connects to or boots device in bootloader mode depending on devInfo state.

Parameters
  • devInfo: DeviceInfo of which to boot or connect to

  • allowFlashingBootloader: Set to true to allow flashing the devices bootloader. Defaults to false

DeviceBootloader(const DeviceInfo &devInfo, Type type, bool allowFlashingBootloader = false)

Connects to device in bootloader of specified type. Throws if it wasn’t possible. This constructor will automatically boot into specified bootloader type if not already running

Parameters
  • devInfo: DeviceInfo of which to boot or connect to

  • type: Type of bootloader to boot/connect to.

  • allowFlashingBootloader: Set to true to allow flashing the devices bootloader. Defaults to false

DeviceBootloader(const DeviceInfo &devInfo, const std::string &pathToBootloader, bool allowFlashingBootloader = false)

Connects to or boots device in bootloader mode depending on devInfo state with a custom bootloader firmware.

Parameters
  • devInfo: DeviceInfo of which to boot or connect to

  • pathToBootloader: Custom bootloader firmware to boot

  • allowFlashingBootloader: Set to true to allow flashing the devices bootloader. Defaults to false

DeviceBootloader(const DeviceInfo &devInfo, const char *pathToBootloader, bool allowFlashingBootloader = false)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

std::tuple<bool, std::string> flash(std::function<void(float)> progressCallback, const Pipeline &pipeline, bool compress = false, )

Flashes a given pipeline to the device.

Parameters
  • progressCallback: Callback that sends back a value between 0..1 which signifies current flashing progress

  • pipeline: Pipeline to flash to the board

std::tuple<bool, std::string> flash(const Pipeline &pipeline, bool compress = false)

Flashes a given pipeline to the device.

Parameters
  • pipeline: Pipeline to flash to the board

std::tuple<bool, std::string> flashDepthaiApplicationPackage(std::function<void(float)> progressCallback, std::vector<uint8_t> package, )

Flashes a specific depthai application package that was generated using createDepthaiApplicationPackage or saveDepthaiApplicationPackage

Parameters
  • progressCallback: Callback that sends back a value between 0..1 which signifies current flashing progress

  • package: Depthai application package to flash to the board

std::tuple<bool, std::string> flashDepthaiApplicationPackage(std::vector<uint8_t> package)

Flashes a specific depthai application package that was generated using createDepthaiApplicationPackage or saveDepthaiApplicationPackage

Parameters
  • package: Depthai application package to flash to the board

std::tuple<bool, std::string> flashBootloader(std::function<void(float)> progressCallback, std::string path = "", )

Flashes bootloader to the current board

Parameters
  • progressCallback: Callback that sends back a value between 0..1 which signifies current flashing progress

  • path: Optional parameter to custom bootloader to flash

std::tuple<bool, std::string> flashBootloader(Memory memory, Type type, std::function<void(float)> progressCallback, std::string path = "", )

Flash selected bootloader to the current board

Parameters
  • memory: Memory to flash

  • type: Bootloader type to flash

  • progressCallback: Callback that sends back a value between 0..1 which signifies current flashing progress

  • path: Optional parameter to custom bootloader to flash

nlohmann::json readConfigData(Memory memory = Memory::AUTO, Type type = Type::AUTO)

Flash arbitrary data at custom offset in specified memory

Return

Unstructured configuration data

Parameters
  • memory: Memory to flash

  • offset: Offset at which to flash the given data in bytes

  • progressCallback: Callback that sends back a value between 0..1 which signifies current flashing progress

  • data: Data to flash Reads configuration data from bootloader

Parameters
  • memory: Optional - from which memory to read configuration data

  • type: Optional - from which type of bootloader to read configuration data

std::tuple<bool, std::string> flashConfigData(nlohmann::json configData, Memory memory = Memory::AUTO, Type type = Type::AUTO)

Flashes configuration data to bootloader

Parameters
  • configData: Unstructured configuration data

  • memory: Optional - to which memory flash configuration

  • type: Optional - for which type of bootloader to flash configuration

std::tuple<bool, std::string> flashConfigFile(std::string configPath, Memory memory = Memory::AUTO, Type type = Type::AUTO)

Flashes configuration data to bootloader

Parameters
  • configPath: Unstructured configuration data

  • memory: Optional - to which memory flash configuration

  • type: Optional - for which type of bootloader to flash configuration

std::tuple<bool, std::string> flashConfigClear(Memory memory = Memory::AUTO, Type type = Type::AUTO)

Clears configuration data

Parameters
  • memory: Optional - on which memory to clear configuration data

  • type: Optional - for which type of bootloader to clear configuration data

Config readConfig(Memory memory = Memory::AUTO, Type type = Type::AUTO)

Reads configuration from bootloader

Return

Configuration structure

Parameters
  • memory: Optional - from which memory to read configuration

  • type: Optional - from which type of bootloader to read configuration

std::tuple<bool, std::string> flashConfig(const Config &config, Memory memory = Memory::AUTO, Type type = Type::AUTO)

Flashes configuration to bootloader

Parameters
  • configData: Configuration structure

  • memory: Optional - to which memory flash configuration

  • type: Optional - for which type of bootloader to flash configuration

void bootMemory(const std::vector<uint8_t> &fw)

Boots a custom FW in memory

Parameters
  • fw:

Exceptions
  • A: runtime exception if there are any communication issues

void bootUsbRomBootloader()

Boots into integrated ROM bootloader in USB mode

Exceptions
  • A: runtime exception if there are any communication issues

Version getVersion() const

Return

Version of current running bootloader

bool isEmbeddedVersion() const

Return

True when bootloader was booted using latest bootloader integrated in the library. False when bootloader is already running on the device and just connected to.

Type getType() const

Return

Type of currently connected bootloader

bool isAllowedFlashingBootloader() const

Return

True if allowed to flash bootloader

void close()

Explicitly closes connection to device.

Note

This function does not need to be explicitly called as destructor closes the device automatically

bool isClosed() const

Is the device already closed (or disconnected)

Public Static Functions

std::tuple<bool, DeviceInfo> getFirstAvailableDevice()

Searches for connected devices in either UNBOOTED or BOOTLOADER states and returns first available.

Return

Tuple of boolean and DeviceInfo. If found boolean is true and DeviceInfo describes the device. Otherwise false

std::vector<DeviceInfo> getAllAvailableDevices()

Searches for connected devices in either UNBOOTED or BOOTLOADER states.

Return

Vector of all found devices

std::vector<uint8_t> createDepthaiApplicationPackage(const Pipeline &pipeline, std::string pathToCmd = "", bool compress = false)

Creates application package which can be flashed to depthai device.

Return

Depthai application package

Parameters
  • pipeline: Pipeline from which to create the application package

  • pathToCmd: Optional path to custom device firmware

  • compress: Optional boolean which specifies if contents should be compressed

std::vector<uint8_t> createDepthaiApplicationPackage(const Pipeline &pipeline, bool compress)

Creates application package which can be flashed to depthai device.

Return

Depthai application package

Parameters
  • pipeline: Pipeline from which to create the application package

  • compress: Specifies if contents should be compressed

void saveDepthaiApplicationPackage(std::string path, const Pipeline &pipeline, std::string pathToCmd = "", bool compress = false)

Saves application package to a file which can be flashed to depthai device.

Parameters
  • path: Path where to save the application package

  • pipeline: Pipeline from which to create the application package

  • pathToCmd: Optional path to custom device firmware

  • compress: Optional boolean which specifies if contents should be compressed

void saveDepthaiApplicationPackage(std::string path, const Pipeline &pipeline, bool compress)

Saves application package to a file which can be flashed to depthai device.

Parameters
  • path: Path where to save the application package

  • pipeline: Pipeline from which to create the application package

  • compress: Specifies if contents should be compressed

Version getEmbeddedBootloaderVersion()

Return

Embedded bootloader version

std::vector<std::uint8_t> getEmbeddedBootloaderBinary(Type type = DEFAULT_TYPE)

Return

Embedded bootloader binary

Public Static Attributes

constexpr const Type DEFAULT_TYPE = {Type::USB}

Default Bootloader type.

struct Config : public dai::bootloader::Config

Public Functions

void setStaticIPv4(std::string ip, std::string mask, std::string gateway)

Setting a static IPv4 won’t start DHCP client.

void setDynamicIPv4(std::string ip, std::string mask, std::string gateway)

Setting a dynamic IPv4 will set that IP as well as start DHCP client.

bool isStaticIPV4()

Get if static IPv4 configuration is set.

std::string getIPv4()

Get IPv4.

std::string getIPv4Mask()

Get IPv4 mask.

std::string getIPv4Gateway()

Get IPv4 gateway.

void setDnsIPv4(std::string dns, std::string dnsAlt = "")

Set IPv4 DNS options.

std::string getDnsIPv4()

Get primary IPv4 DNS server.

std::string getDnsAltIPv4()

Get alternate IPv4 DNS server.

void setUsbTimeout(std::chrono::milliseconds ms)

Set USB timeout.

std::chrono::milliseconds getUsbTimeout()

Get USB timeout.

void setNetworkTimeout(std::chrono::milliseconds ms)

Set NETWOR timeout.

std::chrono::milliseconds getNetworkTimeout()

Get NETWORK timeout.

void setMacAddress(std::string mac)

Set MAC address if not flashed on controller.

std::string getMacAddress()

Get MAC address if not flashed on controller.

void setUsbMaxSpeed(UsbSpeed speed)

Set maxUsbSpeed.

UsbSpeed getUsbMaxSpeed()

Get maxUsbSpeed.

struct Version
#include <DeviceBootloader.hpp>

Bootloader version structure.

Public Functions

Version(const std::string &v)

Construct Version from string.

Version(unsigned major, unsigned minor, unsigned patch)

Construct Version major, minor and patch numbers.

std::string toString() const

Convert Version to string.

struct DeviceInfo
#include <XLinkConnection.hpp>

Describes a connected device

class EdgeDetectorConfig : public dai::Buffer
#include <EdgeDetectorConfig.hpp>

EdgeDetectorConfig message. Carries sobel edge filter config.

Public Functions

EdgeDetectorConfig()

Construct EdgeDetectorConfig message.

void setSobelFilterKernels(const std::vector<std::vector<int>> &horizontalKernel, const std::vector<std::vector<int>> &verticalKernel)

Set sobel filter horizontal and vertical 3x3 kernels

Parameters
  • horizontalKernel: Used for horizontal gradiant computation in 3x3 Sobel filter

  • verticalKernel: Used for vertical gradiant computation in 3x3 Sobel filter

EdgeDetectorConfigData getConfigData() const

Retrieve configuration data for EdgeDetector

Return

EdgeDetectorConfigData: sobel filter horizontal and vertical 3x3 kernels

struct EdgeDetectorConfigData
#include <RawEdgeDetectorConfig.hpp>

EdgeDetectorConfigData configuration data structure.

Public Members

std::vector<std::vector<int>> sobelFilterHorizontalKernel

Used for horizontal gradiant computation in 3x3 Sobel filter Format: 3x3 matrix, 2nd column must be 0 Default: +1 0 -1; +2 0 -2; +1 0 -1

std::vector<std::vector<int>> sobelFilterVerticalKernel

Used for vertical gradiant computation in 3x3 Sobel filter Format: 3x3 matrix, 2nd row must be 0 Default: +1 +2 +1; 0 0 0; -1 -2 -1

struct EdgeDetectorProperties
#include <EdgeDetectorProperties.hpp>

Specify properties for EdgeDetector

Public Members

RawEdgeDetectorConfig initialConfig

Initial edge detector config.

bool inputConfigSync = false

Whether to wait for config at ‘inputConfig’ IO.

int outputFrameSize = 1 * 1024 * 1024

Maximum output frame size in bytes (eg: 300x300 BGR image -> 300*300*3 bytes)

int numFramesPool = 4

Num frames in output pool.

struct EepromData
#include <EepromData.hpp>

EepromData structure

Contains the Calibration and Board data stored on device

struct Extrinsics
#include <Extrinsics.hpp>

Extrinsics structure.

Public Members

Point3f translation

(x, y, z) pose of destCameraSocket w.r.t currentCameraSocket obtained through calibration

Point3f specTranslation

(x, y, z) pose of destCameraSocket w.r.t currentCameraSocket measured through CAD design

class FeatureTrackerConfig : public dai::Buffer
#include <FeatureTrackerConfig.hpp>

FeatureTrackerConfig message. Carries config for feature tracking algorithm

Public Functions

FeatureTrackerConfig()

Construct FeatureTrackerConfig message.

void setCornerDetector(dai::FeatureTrackerConfig::CornerDetector::Type cornerDetector)

Set corner detector algorithm type.

Parameters
  • cornerDetector: Corner detector type, HARRIS or SHI_THOMASI

void setCornerDetector(dai::FeatureTrackerConfig::CornerDetector config)

Set corner detector full configuration.

Parameters
  • config: Corner detector configuration

void setOpticalFlow()

Set optical flow as motion estimation algorithm type.

void setOpticalFlow(dai::FeatureTrackerConfig::MotionEstimator::OpticalFlow config)

Set optical flow full configuration.

Parameters
  • config: Optical flow configuration

void setHwMotionEstimation()

Set hardware accelerated motion estimation using block matching. Faster than optical flow (software implementation) but might not be as accurate.

void setNumTargetFeatures(std::int32_t numTargetFeatures)

Set number of target features to detect.

Parameters
  • numTargetFeatures: Number of features

void setMotionEstimator(bool enable)

Enable or disable motion estimator.

Parameters
  • enable:

void setMotionEstimator(dai::FeatureTrackerConfig::MotionEstimator config)

Set motion estimator full configuration.

Parameters
  • config: Motion estimator configuration

void setFeatureMaintainer(bool enable)

Enable or disable feature maintainer.

Parameters
  • enable:

void setFeatureMaintainer(dai::FeatureTrackerConfig::FeatureMaintainer config)

Set feature maintainer full configuration.

Parameters
  • config: feature maintainer configuration

void set(dai::RawFeatureTrackerConfig config)

Set explicit configuration.

Parameters
  • config: Explicit configuration

dai::RawFeatureTrackerConfig get() const

Retrieve configuration data for FeatureTracker.

Return

config for feature tracking algorithm

struct FeatureTrackerProperties
#include <FeatureTrackerProperties.hpp>

Specify properties for FeatureTracker

Public Members

RawFeatureTrackerConfig initialConfig

Initial feature tracker config

bool inputConfigSync = false

Whether to wait for config at ‘inputConfig’ IO

std::int32_t numShaves = 1

Number of shaves reserved for feature tracking. Optical flow can use 1 or 2 shaves, while for corner detection only 1 is enough. Hardware motion estimation doesn’t require shaves. Maximum 2, minimum 1.

std::int32_t numMemorySlices = 1

Number of memory slices reserved for feature tracking. Optical flow can use 1 or 2 memory slices, while for corner detection only 1 is enough. Maximum number of features depends on the number of allocated memory slices. Hardware motion estimation doesn’t require memory slices. Maximum 2, minimum 1.

struct GlobalProperties
#include <GlobalProperties.hpp>

Specify properties which apply for whole pipeline

Public Members

double leonCssFrequencyHz = 700 * 1000 * 1000

Set frequency of Leon OS - Increasing can improve performance, at the cost of higher power draw

double leonMssFrequencyHz = 700 * 1000 * 1000

Set frequency of Leon RT - Increasing can improve performance, at the cost of higher power draw

tl::optional<dai::EepromData> calibData

Calibration data sent through pipeline

tl::optional<std::uint32_t> cameraTuningBlobSize

Camera tuning blob size in bytes

std::string cameraTuningBlobUri

Uri which points to camera tuning blob

int32_t xlinkChunkSize = -1

Chunk size for splitting device-sent XLink packets, in bytes. A larger value could increase performance, with 0 disabling chunking. A negative value won’t modify the device defaults - configured per protocol, currently 64*1024 for both USB and Ethernet.

class ImageManipConfig : public dai::Buffer
#include <ImageManipConfig.hpp>

ImageManipConfig message. Specifies image manipulation options like:

  • Crop

  • Resize

  • Warp

Public Functions

ImageManipConfig()

Construct ImageManipConfig message.

void setCropRect(float xmin, float ymin, float xmax, float ymax)

Specifies crop with rectangle with normalized values (0..1)

Parameters
  • xmin: Top left X coordinate of rectangle

  • ymin: Top left Y coordinate of rectangle

  • xmax: Bottom right X coordinate of rectangle

  • ymax: Bottom right Y coordinate of rectangle

void setCropRect(std::tuple<float, float, float, float> coordinates)

Specifies crop with rectangle with normalized values (0..1)

Parameters
  • coordinates: Coordinate of rectangle

void setCropRotatedRect(RotatedRect rr, bool normalizedCoords = true)

Specifies crop with rotated rectangle. Optionally as non normalized coordinates

Parameters
  • rr: Rotated rectangle which specifies crop

  • normalizedCoords: If true coordinates are in normalized range (0..1) otherwise absolute

void setCenterCrop(float ratio, float whRatio = 1.0f)

Specifies a centered crop.

Parameters
  • ratio: Ratio between input image and crop region (0..1)

  • whRatio: Crop region aspect ratio - 1 equals to square, 1.7 equals to 16:9, …

void setWarpTransformFourPoints(std::vector<Point2f> pt, bool normalizedCoords)

Specifies warp by suppling 4 points in either absolute or normalized coordinates

Parameters
  • pt: 4 points specifying warp

  • normalizedCoords: If true pt is interpreted as normalized, absolute otherwise

void setWarpTransformMatrix3x3(std::vector<float> mat)

Specifies warp with a 3x3 matrix

Parameters
  • mat: 3x3 matrix

void setWarpBorderReplicatePixels()

Specifies that warp replicates border pixels

void setWarpBorderFillColor(int red, int green, int blue)

Specifies fill color for border pixels. Example:

  • setWarpBorderFillColor(255,255,255) -> white

  • setWarpBorderFillColor(0,0,255) -> blue

Parameters
  • red: Red component

  • green: Green component

  • blue: Blue component

void setRotationDegrees(float deg)

Specifies clockwise rotation in degrees

Parameters
  • deg: Rotation in degrees

void setRotationRadians(float rad)

Specifies clockwise rotation in radians

Parameters
  • rad: Rotation in radians

void setResize(int w, int h)

Specifies output image size. After crop stage the image will be streched to fit.

Parameters
  • w: Width in pixels

  • h: Height in pixels

void setResize(std::tuple<int, int> size)

Specifies output image size. After crop stage the image will be streched to fit.

Parameters
  • size: Size in pixels

void setResizeThumbnail(int w, int h, int bgRed = 0, int bgGreen = 0, int bgBlue = 0)

Specifies output image size. After crop stage the image will be resized by preserving aspect ration. Optionally background can be specified.

Parameters
  • w: Width in pixels

  • h: Height in pixels

  • bgRed: Red component

  • bgGreen: Green component

  • bgBlue: Blue component

void setResizeThumbnail(std::tuple<int, int> size, int bgRed = 0, int bgGreen = 0, int bgBlue = 0)

Specifies output image size. After crop stage the image will be resized by preserving aspect ration. Optionally background can be specified.

Parameters
  • size: Size in pixels

  • bgRed: Red component

  • bgGreen: Green component

  • bgBlue: Blue component

void setFrameType(ImgFrame::Type name)

Specify output frame type.

Parameters
  • name: Frame type

void setHorizontalFlip(bool flip)

Specify horizontal flip

Parameters
  • flip: True to enable flip, false otherwise

void setReusePreviousImage(bool reuse)

Instruct ImageManip to not remove current image from its queue and use the same for next message.

Parameters
  • reuse: True to enable reuse, false otherwise

void setSkipCurrentImage(bool skip)

Instructs ImageManip to skip current image and wait for next in queue.

Parameters
  • skip: True to skip current image, false otherwise

void setKeepAspectRatio(bool keep)

Specifies to whether to keep aspect ratio or not

float getCropXMin() const

Return

Top left X coordinate of crop region

float getCropYMin() const

Return

Top left Y coordinate of crop region

float getCropXMax() const

Return

Bottom right X coordinate of crop region

float getCropYMax() const

Return

Bottom right Y coordinate of crop region

int getResizeWidth() const

Return

Output image width

int getResizeHeight() const

Return

Output image height

CropConfig getCropConfig() const

Return

Crop configuration

ResizeConfig getResizeConfig() const

Return

Resize configuration

FormatConfig getFormatConfig() const

Return

Format configuration

bool isResizeThumbnail() const

Return

True if resize thumbnail mode is set, false otherwise

struct ImageManipProperties
#include <ImageManipProperties.hpp>

Specify properties for ImageManip

Public Members

RawImageManipConfig initialConfig

Initial configuration for ImageManip node.

bool inputConfigSync = false

Whether to wait for config at ‘inputConfig’ IO.

int outputFrameSize = 1 * 1024 * 1024

Maximum output frame size in bytes (eg: 300x300 BGR image -> 300*300*3 bytes)

int numFramesPool = 4

Num frames in output pool.

struct ImgDetection
#include <RawImgDetections.hpp>

ImgDetection structure.

Subclassed by dai::SpatialImgDetection

class ImgDetections : public dai::Buffer
#include <ImgDetections.hpp>

ImgDetections message. Carries normalized detection results

Public Functions

ImgDetections()

Construct ImgDetections message.

Public Members

std::vector<ImgDetection> &detections

Detections.

class ImgFrame : public dai::Buffer
#include <ImgFrame.hpp>

ImgFrame message. Carries image data and metadata.

Public Functions

ImgFrame()

Construct ImgFrame message. Timestamp is set to now

std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> getTimestamp() const

Retrieves image timestamp related to steady_clock / time.monotonic

std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> getTimestampDevice() const

Retrieves image timestamp directly captured from device’s monotonic clock, not synchronized to host time. Used mostly for debugging

unsigned int getInstanceNum() const

Retrieves instance number

unsigned int getCategory() const

Retrieves image category

unsigned int getSequenceNum() const

Retrieves image sequence number

unsigned int getWidth() const

Retrieves image width in pixels

unsigned int getHeight() const

Retrieves image height in pixels

Type getType() const

Retrieves image type

void setTimestamp(std::chrono::time_point<std::chrono::steady_clock, std::chrono::steady_clock::duration> timestamp)

Specifies current timestamp, related to steady_clock / time.monotonic

void setInstanceNum(unsigned int instance)

Instance number relates to the origin of the frame (which camera)

Parameters
  • instance: Instance number

void setCategory(unsigned int category)

Parameters
  • category: Image category

void setSequenceNum(unsigned int seq)

Specifies sequence number

Parameters
  • seq: Sequence number

void setWidth(unsigned int width)

Specifies frame width

Parameters
  • width: frame width

void setHeight(unsigned int height)

Specifies frame height

Parameters
  • height: frame height

void setSize(unsigned int width, unsigned int height)

Specifies frame size

Parameters
  • height: frame height

  • width: frame width

void setSize(std::tuple<unsigned int, unsigned int> size)

Specifies frame size

Parameters
  • size: frame size

void setType(Type type)

Specifies frame type, RGB, BGR, …

Parameters
  • type: Type of image

void setFrame(cv::Mat frame)

Copies cv::Mat data to

ImgFrame buffer
Note

This API only available if OpenCV support is enabled

Parameters
  • frame: Input cv::Mat frame from which to copy the data

cv::Mat getFrame(bool copy = false)

Retrieves data as cv::Mat with specified width, height and type

Note

This API only available if OpenCV support is enabled

Return

cv::Mat with corresponding to ImgFrame parameters

Parameters
  • copy: If false only a reference to data is made, otherwise a copy

cv::Mat getCvFrame()

Retrieves cv::Mat suitable for use in common opencv functions.

ImgFrame is converted to color BGR interleaved or grayscale depending on type.
Note

This API only available if OpenCV support is enabled

A copy is always made

Return

cv::Mat for use in opencv functions

class IMUData : public dai::Buffer
#include <IMUData.hpp>

IMUData message. Carries normalized detection results

Public Functions

IMUData()

Construct IMUData message.

Public Members

std::vector<IMUPacket> &packets

Detections.

struct IMUPacket
#include <RawIMUData.hpp>

IMU output

Contains combined output for all possible modes. Only the enabled outputs are populated.

struct IMUProperties
struct IMUReport

Subclassed by dai::IMUReportAccelerometer, dai::IMUReportGyroscope, dai::IMUReportMagneticField, dai::IMUReportRotationVectorWAcc

Public Members

int32_t sequence = 0

The sequence number increments once for each report sent. Gaps in the sequence numbers indicate missing or dropped reports. Max value 255 after which resets to 0.

Accuracy accuracy = Accuracy::UNRELIABLE

Accuracy of sensor

struct IMUReportAccelerometer : public dai::IMUReport
#include <RawIMUData.hpp>

Accelerometer.

Units are [m/s^2]

struct IMUReportGyroscope : public dai::IMUReport
#include <RawIMUData.hpp>

Gyroscope.

Units are [rad/s]

struct IMUReportMagneticField : public dai::IMUReport
#include <RawIMUData.hpp>

Magnetic field.

Units are [uTesla]

struct IMUReportRotationVectorWAcc : public dai::IMUReport
#include <RawIMUData.hpp>

Rotation Vector with Accuracy.

Contains quaternion components: i,j,k,real

Public Members

float i = 0

Quaternion component i.

float j = 0

Quaternion component j.

float k = 0

Quaternion component k.

float real = 0

Quaternion component, real.

float rotationVectorAccuracy = 0

Accuracy estimate [radians], 0 means no estimate.

struct IMUSensorConfig

Public Members

bool sensitivityRelative = false

Change reports relative (vs absolute)

uint16_t changeSensitivity = 0

Report-on-change threshold.

template<typename T>
class LockingQueue
struct LogMessage
struct MemoryInfo
#include <MemoryInfo.hpp>

MemoryInfo structure

Free, remaining and total memory stats

struct MonoCameraProperties
#include <MonoCameraProperties.hpp>

Specify properties for MonoCamera such as camera ID, …

Public Types

enum SensorResolution

Select the camera sensor resolution: 1280×720, 1280×800, 640×400, 640×480

Values:

enumerator THE_720_P
enumerator THE_800_P
enumerator THE_400_P
enumerator THE_480_P

Public Members

CameraBoardSocket boardSocket = CameraBoardSocket::AUTO

Which socket will mono camera use

CameraImageOrientation imageOrientation = CameraImageOrientation::AUTO

Camera sensor image orientation / pixel readout

SensorResolution resolution = SensorResolution::THE_720_P

Select the camera sensor resolution

float fps = 30.0

Camera sensor FPS

struct MyConsumerProperties
#include <MyConsumerProperties.hpp>

Specify message and processor placement of MyConsumer node

Public Members

ProcessorType processorPlacement

On which processor the node will be placed

struct MyProducerProperties
#include <MyProducerProperties.hpp>

Specify message and processor placement of MyProducer node

Public Members

tl::optional<std::string> message

Message to be sent forward

ProcessorType processorPlacement = ProcessorType::LEON_CSS

On which processor the node will be placed

struct NeuralNetworkProperties
#include <NeuralNetworkProperties.hpp>

Specify properties for NeuralNetwork such as blob path, …

Subclassed by dai::DetectionNetworkProperties

Public Members

tl::optional<std::uint32_t> blobSize

Blob binary size in bytes

std::string blobUri

Uri which points to blob

std::uint32_t numFrames = 8

Number of available output tensors in pool

std::uint32_t numThreads = 0

Number of threads to create for running inference. 0 = auto

std::uint32_t numNCEPerThread = 0

Number of NCE (Neural Compute Engine) per inference thread. 0 = auto

class NNData : public dai::Buffer
#include <NNData.hpp>

NNData message. Carries tensors and their metadata

Public Functions

NNData()

Construct NNData message.

void setLayer(const std::string &name, std::vector<std::uint8_t> data)

Set a layer with datatype U8.

Parameters
  • name: Name of the layer

  • data: Data to store

void setLayer(const std::string &name, const std::vector<int> &data)

Set a layer with datatype U8. Integers are casted to bytes.

Parameters
  • name: Name of the layer

  • data: Data to store

void setLayer(const std::string &name, std::vector<float> data)

Set a layer with datatype FP16. Float values are converted to FP16.

Parameters
  • name: Name of the layer

  • data: Data to store

void setLayer(const std::string &name, std::vector<double> data)

Set a layer with datatype FP16. Double values are converted to FP16.

Parameters
  • name: Name of the layer

  • data: Data to store

std::vector<std::string> getAllLayerNames() const

Return

Names of all layers added

std::vector<TensorInfo> getAllLayers() const

Return

All layers and their information

bool getLayer(const std::string &name, TensorInfo &tensor) const

Retrieve layers tensor information

Return

True if layer exists, false otherwise

Parameters
  • name: Name of the layer

  • [out] tensor: Outputs tensor infromation of that layer

bool hasLayer(const std::string &name) const

Checks if given layer exists

Return

True if layer exists, false otherwise

Parameters
  • name: Name of the layer

bool getLayerDatatype(const std::string &name, TensorInfo::DataType &datatype) const

Retrieve datatype of a layers tensor

Return

True if layer exists, false otherwise

Parameters
  • name: Name of the layer

  • [out] datatype: Datatype of layers tensor

std::vector<std::uint8_t> getLayerUInt8(const std::string &name) const

Convinience function to retrieve U8 data from layer

Return

U8 binary data

Parameters
  • name: Name of the layer

std::vector<float> getLayerFp16(const std::string &name) const

Convinience function to retrieve float values from layers FP16 tensor

Return

Float data

Parameters
  • name: Name of the layer

std::vector<std::int32_t> getLayerInt32(const std::string &name) const

Convinience function to retrieve INT32 values from layers tensor

Return

INT32 data

Parameters
  • name: Name of the layer

std::vector<std::uint8_t> getFirstLayerUInt8() const

Convinience function to retrieve U8 data from first layer

Return

U8 binary data

std::vector<float> getFirstLayerFp16() const

Convinience function to retrieve float values from first layers FP16 tensor

Return

Float data

std::vector<std::int32_t> getFirstLayerInt32() const

Convinience function to retrieve INT32 values from first layers tensor

Return

INT32 data

class Node
#include <Node.hpp>

Abstract Node.

Subclassed by dai::node::ColorCamera, dai::node::EdgeDetector, dai::node::FeatureTracker, dai::node::ImageManip, dai::node::IMU, dai::node::MonoCamera, dai::node::MyProducer, dai::node::NeuralNetwork, dai::node::ObjectTracker, dai::node::Script, dai::node::SpatialLocationCalculator, dai::node::SPIIn, dai::node::SPIOut, dai::node::StereoDepth, dai::node::SystemLogger, dai::node::VideoEncoder, dai::node::XLinkIn, dai::node::XLinkOut

Public Types

using Id = std::int64_t

Node identificator. Unique for every node on a single Pipeline.

Public Functions

std::string getName() const = 0

Retrieves nodes name.

std::vector<Output> getOutputs()

Retrieves all nodes outputs.

std::vector<Input> getInputs()

Retrieves all nodes inputs.

std::vector<Output*> getOutputRefs()

Retrieves reference to node outputs.

std::vector<const Output*> getOutputRefs() const

Retrieves reference to node outputs.

std::vector<Input*> getInputRefs()

Retrieves reference to node inputs.

std::vector<const Input*> getInputRefs() const

Retrieves reference to node inputs.

const AssetManager &getAssetManager() const

Get node AssetManager as a const reference.

AssetManager &getAssetManager()

Get node AssetManager as a reference.

Public Members

const Id id

Id of node.

struct Connection
#include <Node.hpp>

Connection between an Input and Output.

struct NodeConnectionSchema
#include <NodeConnectionSchema.hpp>

Specifies a connection between nodes IOs

struct NodeIoInfo
#include <NodeIoInfo.hpp>

NodeIo informations such as name, type, …

struct NodeObjInfo
#include <NodeObjInfo.hpp>

NodeObj information structure.

struct ObjectTrackerProperties
#include <ObjectTrackerProperties.hpp>

Specify properties for ObjectTracker

class OpenVINO
#include <OpenVINO.hpp>

Support for basic OpenVINO related actions like version identification of neural network blobs,…

Public Types

enum Version

OpenVINO Version supported version information.

Values:

enumerator VERSION_2020_3
enumerator VERSION_2020_4
enumerator VERSION_2021_1
enumerator VERSION_2021_2
enumerator VERSION_2021_3
enumerator VERSION_2021_4

Public Static Functions

std::vector<Version> getVersions()

Return

Supported versions

std::string getVersionName(Version version)

Returns string representation of a given version

Return

Name of a given version

Parameters

Version parseVersionName(const std::string &versionString)

Creates Version from string representation. Throws if not possible.

Return

Version object if successful

Parameters
  • versionString: Version as string

std::vector<Version> getBlobSupportedVersions(std::uint32_t majorVersion, std::uint32_t minorVersion)

Returns a list of potentionally supported versions for a specified blob major and minor versions.

Return

Vector of potentionally supported versions

Parameters
  • majorVersion: Major version from OpenVINO blob

  • minorVersion: Minor version from OpenVINO blob

Version getBlobLatestSupportedVersion(std::uint32_t majorVersion, std::uint32_t minorVersion)

Returns latest potentionally supported version by a given blob version.

Return

Latest potentionally supported version

Parameters
  • majorVersion: Major version from OpenVINO blob

  • minorVersion: Minor version from OpenVINO blob

bool areVersionsBlobCompatible(Version v1, Version v2)

Checks whether two blob versions are compatible

Public Static Attributes

constexpr const Version DEFAULT_VERSION = VERSION_2021_4

Main OpenVINO version.

template<typename T>
class Pimpl
class Pipeline
#include <Pipeline.hpp>

Represents the pipeline, set of nodes and connections between them.

Public Functions

Pipeline()

Constructs a new pipeline

Pipeline clone() const

Clone the pipeline (Creates a copy)

GlobalProperties getGlobalProperties() const

Return

Global properties of current pipeline

PipelineSchema getPipelineSchema()

Return

Pipeline schema

template<class N>
std::shared_ptr<N> create()

Adds a node to pipeline.

Node is specified by template argument N

void remove(std::shared_ptr<Node> node)

Removes a node from pipeline.

std::vector<std::shared_ptr<const Node>> getAllNodes() const

Get a vector of all nodes.

std::vector<std::shared_ptr<Node>> getAllNodes()

Get a vector of all nodes.

std::shared_ptr<const Node> getNode(Node::Id id) const

Get node with id if it exists, nullptr otherwise.

std::shared_ptr<Node> getNode(Node::Id id)

Get node with id if it exists, nullptr otherwise.

std::vector<Node::Connection> getConnections() const

Get all connections.

const NodeConnectionMap &getConnectionMap() const

Get a reference to internal connection representation.

const NodeMap &getNodeMap() const

Get a reference to internal node map.

void link(const Node::Output &out, const Node::Input &in)

Link output to an input. Both nodes must be on the same pipeline

Throws an error if they aren’t or cannot be connected

Parameters
  • out: Nodes output to connect from

  • in: Nodes input to connect to

void unlink(const Node::Output &out, const Node::Input &in)

Unlink output from an input.

Throws an error if link doesn’t exists

Parameters
  • out: Nodes output to unlink from

  • in: Nodes input to unlink to

const AssetManager &getAssetManager() const

Get pipelines AssetManager as reference.

AssetManager &getAssetManager()

Get pipelines AssetManager as reference.

void setOpenVINOVersion(OpenVINO::Version version)

Set a specific OpenVINO version to use with this pipeline.

void setCalibrationData(CalibrationHandler calibrationDataHandler)

Sets the calibration in pipeline which overrides the calibration data in eeprom

Parameters
  • calibrationDataHandler: CalibrationHandler object which is loaded with calibration information.

CalibrationHandler getCalibrationData() const

gets the calibration data which is set through pipeline

Return

the calibrationHandler with calib data in the pipeline

OpenVINO::Version getOpenVINOVersion() const

Get possible OpenVINO version to run this pipeline.

tl::optional<OpenVINO::Version> getRequiredOpenVINOVersion() const

Get required OpenVINO version to run this pipeline. Can be none.

void setCameraTuningBlobPath(const std::string &path)

Set a camera IQ (Image Quality) tuning blob, used for all cameras.

void setXLinkChunkSize(int sizeBytes)

Set chunk size for splitting device-sent XLink packets, in bytes. A larger value could increase performance, with 0 disabling chunking. A negative value won’t modify the device defaults - configured per protocol, currently 64*1024 for both USB and Ethernet.

bool isOpenVINOVersionCompatible(OpenVINO::Version version) const

Checks whether a given OpenVINO version is compatible with the pipeline.

Device::Config getDeviceConfig() const

Get device configuration needed for this pipeline.

class PipelineImpl
struct PipelineSchema
#include <PipelineSchema.hpp>

Specifies whole pipeline, nodes, properties and connections between nodes IOs

struct Point2f
#include <Point2f.hpp>

Point2f structure

x and y coordinates that define a 2D point.

struct Point3f
#include <Point3f.hpp>

Point3f structure

x,y,z coordinates that define a 3D point.

struct PrebootConfig
struct USB
struct RawBuffer
#include <RawBuffer.hpp>

RawBuffer structure.

Subclassed by dai::RawCameraControl, dai::RawEdgeDetectorConfig, dai::RawFeatureTrackerConfig, dai::RawImageManipConfig, dai::RawImgDetections, dai::RawImgFrame, dai::RawIMUData, dai::RawNNData, dai::RawSpatialImgDetections, dai::RawSpatialLocationCalculatorConfig, dai::RawSpatialLocations, dai::RawStereoDepthConfig, dai::RawSystemInformation, dai::RawTrackedFeatures, dai::RawTracklets

struct RawCameraControl : public dai::RawBuffer
#include <RawCameraControl.hpp>

RawCameraControl structure.

Public Members

uint8_t lensPosition = 0

Lens/VCM position, range: 0..255. Used with autoFocusMode = OFF. With current IMX378 modules:

  • max 255: macro focus, at 8cm distance

  • infinite focus at about 120..130 (may vary from module to module)

  • lower values lead to out-of-focus (lens too close to the sensor array)

struct ManualExposureParams
struct RegionParams
struct RawEdgeDetectorConfig : public dai::RawBuffer
#include <RawEdgeDetectorConfig.hpp>

RawEdgeDetectorConfig configuration structure.

struct RawFeatureTrackerConfig : public dai::RawBuffer
#include <RawFeatureTrackerConfig.hpp>

RawFeatureTrackerConfig configuration structure.

Public Members

CornerDetector cornerDetector

Corner detector configuration. Used for feature detection.

MotionEstimator motionEstimator

Motion estimator configuration. Used for feature reidentification between current and previos features.

FeatureMaintainer featureMaintainer

FeatureMaintainer configuration. Used for feature maintaining.

struct CornerDetector
#include <RawFeatureTrackerConfig.hpp>

Corner detector configuration structure.

Public Members

Type type = Type::HARRIS

Corner detector algorithm type.

std::int32_t cellGridDimension = 4

Ensures distributed feature detection across the image. Image is divided into horizontal and vertical cells, each cell has a target feature count = numTargetFeatures / cellGridDimension. Each cell has its own feature threshold. A value of 4 means that the image is divided into 4x4 cells of equal width/height. Maximum 4, minimum 1.

std::int32_t numTargetFeatures = 320

Target number of features to detect. Maximum number of features is determined at runtime based on algorithm type.

std::int32_t numMaxFeatures = AUTO

Hard limit for the maximum number of features that can be detected. 0 means auto, will be set to the maximum value based on memory constraints.

bool enableSobel = true

Enable 3x3 Sobel operator to smoothen the image whose gradient is to be computed. If disabled, a simple 1D row/column differentiator is used for gradient.

bool enableSorting = true

Enable sorting detected features based on their score or not.

Thresholds thresholds

Threshold settings. These are advanced settings, suitable for debugging/special cases.

struct Thresholds
#include <RawFeatureTrackerConfig.hpp>

Threshold settings structure for corner detector.

Public Members

float initialValue = AUTO

Minimum strength of a feature which will be detected. 0 means automatic threshold update. Recommended so the tracker can adapt to different scenes/textures. Each cell has its own threshold. Empirical value.

float min = AUTO

Minimum limit for threshold. Applicable when automatic threshold update is enabled. 0 means auto, 6000000 for HARRIS, 1200 for SHI_THOMASI. Empirical value.

float max = AUTO

Maximum limit for threshold. Applicable when automatic threshold update is enabled. 0 means auto. Empirical value.

float decreaseFactor = 0.9f

When detected number of features exceeds the maximum in a cell threshold is lowered by multiplying its value with this factor.

float increaseFactor = 1.1f

When detected number of features doesn’t exceed the maximum in a cell, threshold is increased by multiplying its value with this factor.

struct FeatureMaintainer
#include <RawFeatureTrackerConfig.hpp>

FeatureMaintainer configuration structure.

Public Members

bool enable = true

Enable feature maintaining or not.

float minimumDistanceBetweenFeatures = 50

Used to filter out detected feature points that are too close. Requires sorting enabled in detector. Unit of measurement is squared euclidian distance in pixels.

float lostFeatureErrorThreshold = 50000

Optical flow measures the tracking error for every feature. If the point can’t be tracked or it’s out of the image it will set this error to a maximum value. This threshold defines the level where the tracking accuracy is considered too bad to keep the point.

float trackedFeatureThreshold = 200000

Once a feature was detected and we started tracking it, we need to update its Harris score on each image. This is needed because a feature point can disappear, or it can become too weak to be tracked. This threshold defines the point where such a feature must be dropped. As the goal of the algorithm is to provide longer tracks, we try to add strong points and track them until they are absolutely untrackable. This is why, this value is usually smaller than the detection threshold.

struct MotionEstimator
#include <RawFeatureTrackerConfig.hpp>

Used for feature reidentification between current and previous features.

Public Members

bool enable = true

Enable motion estimation or not.

Type type = Type::LUCAS_KANADE_OPTICAL_FLOW

Motion estimator algorithm type.

OpticalFlow opticalFlow

Optical flow configuration. Takes effect only if MotionEstimator algorithm type set to LUCAS_KANADE_OPTICAL_FLOW.

struct OpticalFlow
#include <RawFeatureTrackerConfig.hpp>

Optical flow configuration structure.

Public Members

std::int32_t pyramidLevels = AUTO

Number of pyramid levels, only for optical flow. AUTO means it’s decided based on input resolution: 3 if image width <= 640, else 4. Valid values are either 3/4 for VGA, 4 for 720p and above.

std::int32_t searchWindowWidth = 5

Image patch width used to track features. Must be an odd number, maximum 9. N means the algorithm will be able to track motion at most (N-1)/2 pixels in a direction per pyramid level. Increasing this number increases runtime

std::int32_t searchWindowHeight = 5

Image patch height used to track features. Must be an odd number, maximum 9. N means the algorithm will be able to track motion at most (N-1)/2 pixels in a direction per pyramid level. Increasing this number increases runtime

float epsilon = 0.01f

Feature tracking termination criteria. Optical flow will refine the feature position on each pyramid level until the displacement between two refinements is smaller than this value. Decreasing this number increases runtime.

std::int32_t maxIterations = 9

Feature tracking termination criteria. Optical flow will refine the feature position maximum this many times on each pyramid level. If the Epsilon criteria described in the previous chapter is not met after this number of iterations, the algorithm will continue with the current calculated value. Increasing this number increases runtime.

struct RawImageManipConfig : public dai::RawBuffer
#include <RawImageManipConfig.hpp>

RawImageManipConfig structure.

struct CropConfig
struct CropRect
struct FormatConfig
struct ResizeConfig

Public Members

bool keepAspectRatio = true

Whether to keep aspect ratio of input or not

struct RawImgDetections : public dai::RawBuffer
#include <RawImgDetections.hpp>

RawImgDetections structure.

struct RawImgFrame : public dai::RawBuffer
#include <RawImgFrame.hpp>

RawImgFrame structure.

struct Specs
struct RawIMUData : public dai::RawBuffer
struct RawNNData : public dai::RawBuffer
#include <RawNNData.hpp>

RawNNData structure.

struct RawSpatialImgDetections : public dai::RawBuffer
#include <RawSpatialImgDetections.hpp>

RawSpatialImgDetections structure.

struct RawSpatialLocationCalculatorConfig : public dai::RawBuffer
#include <RawSpatialLocationCalculatorConfig.hpp>

RawSpatialLocation configuration structure.

struct RawSpatialLocations : public dai::RawBuffer
#include <RawSpatialLocations.hpp>

RawSpatialLocations structure.

struct RawStereoDepthConfig : public dai::RawBuffer
#include <RawStereoDepthConfig.hpp>

RawStereoDepthConfig configuration structure.

Public Members

AlgorithmControl algorithmControl

Controls the flow of stereo algorithm: left-right check, subpixel etc.

PostProcessing postProcessing

Controls the postprocessing of disparity and/or depth map.

CensusTransform censusTransform

Census transform settings.

CostMatching costMatching

Cost matching settings.

CostAggregation costAggregation

Cost aggregation settings.

struct AlgorithmControl

Public Members

bool enableLeftRightCheck = true

Computes and combines disparities in both L-R and R-L directions, and combine them. For better occlusion handling

bool enableExtended = false

Disparity range increased from 95 to 190, combined from full resolution and downscaled images. Suitable for short range objects

bool enableSubpixel = false

Computes disparity with sub-pixel interpolation (5 fractional bits), suitable for long range

std::int32_t leftRightCheckThreshold = 10

Left-right check threshold for left-right, right-left disparity map combine, 0..128 Used only when left-right check mode is enabled. Defines the maximum difference between the confidence of pixels from left-right and right-left confidence maps

std::int32_t subpixelFractionalBits = 3

Number of fractional bits for subpixel mode. Valid values: 3,4,5. Defines the number of fractional disparities: 2^x. Median filter postprocessing is supported only for 3 fractional bits.

struct CensusTransform
#include <RawStereoDepthConfig.hpp>

The basic cost function used by the Stereo Accelerator for matching the left and right images is the Census Transform. It works on a block of pixels and computes a bit vector which represents the structure of the image in that block. There are two types of Census Transform based on how the middle pixel is used: Classic Approach and Modified Census. The comparisons that are made between pixels can be or not thresholded. In some cases a mask can be applied to filter out only specific bits from the entire bit stream. All these approaches are: Classic Approach: Uses middle pixel to compare against all its neighbors over a defined window. Each comparison results in a new bit, that is 0 if central pixel is smaller, or 1 if is it bigger than its neighbor. Modified Census Transform: same as classic Census Transform, but instead of comparing central pixel with its neighbors, the window mean will be compared with each pixel over the window. Thresholding Census Transform: same as classic Census Transform, but it is not enough that a neighbor pixel to be bigger than the central pixel, it must be significant bigger (based on a threshold). Census Transform with Mask: same as classic Census Transform, but in this case not all of the pixel from the support window are part of the binary descriptor. We use a ma sk “M” to define which pixels are part of the binary descriptor (1), and which pixels should be skipped (0).

Public Types

enum KernelSize

Census transform kernel size possible values.

Values:

enumerator AUTO
enumerator KERNEL_5x5
enumerator KERNEL_7x7
enumerator KERNEL_7x9

Public Members

KernelSize kernelSize = KernelSize::AUTO

Census transform kernel size.

uint64_t kernelMask = 0

Census transform mask, default: auto, mask is set based on resolution and kernel size. Disabled for 400p input resolution. Enabled for 720p. 0XA82415 for 5x5 census transform kernel. 0XAA02A8154055 for 7x7 census transform kernel. 0X2AA00AA805540155 for 7x9 census transform kernel. Empirical values.

bool enableMeanMode = true

If enabled, each pixel in the window is compared with the mean window value instead of the central pixel.

uint32_t threshold = 0

Census transform comparation treshold value.

struct CostAggregation
#include <RawStereoDepthConfig.hpp>

Cost Aggregation is based on Semi Global Block Matching (SGBM). This algorithm uses a semi global technique to aggregate the cost map. Ultimately the idea is to build inertia into the stereo algorithm. If a pixel has very little texture information, then odds are the correct disparity for this pixel is close to that of the previous pixel considered. This means that we get improved results in areas with low texture.

Public Members

uint8_t divisionFactor = 1

Cost calculation linear equation parameters.

uint16_t horizontalPenaltyCostP1 = defaultPenaltyP1

Horizontal P1 penalty cost parameter.

uint16_t horizontalPenaltyCostP2 = defaultPenaltyP2

Horizontal P2 penalty cost parameter.

uint16_t verticalPenaltyCostP1 = defaultPenaltyP1

Vertical P1 penalty cost parameter.

uint16_t verticalPenaltyCostP2 = defaultPenaltyP2

Vertical P2 penalty cost parameter.

struct CostMatching
#include <RawStereoDepthConfig.hpp>

The matching cost is way of measuring the similarity of image locations in stereo correspondence algorithm. Based on the configuration parameters and based on the descriptor type, a linear equation is applied to computing the cost for each candidate disparity at each pixel.

Public Types

enum DisparityWidth

Disparity search range: 64 or 96 pixels are supported by the HW.

Values:

enumerator DISPARITY_64
enumerator DISPARITY_96

Public Members

DisparityWidth disparityWidth = DisparityWidth::DISPARITY_96

Disparity search range, default 96 pixels.

bool enableCompanding = false

Disparity companding using sparse matching. Matching pixel by pixel for N disparities. Matching every 2nd pixel for M disparitites. Matching every 4th pixel for T disparities. In case of 96 disparities: N=48, M=32, T=16. This way the search range is extended to 176 disparities, by sparse matching. Note: when enabling this flag only depth map will be affected, disparity map is not.

uint8_t invalidDisparityValue = 0

Used only for debug purposes, SW postprocessing handled only invalid value of 0 properly.

uint8_t confidenceThreshold = 245

Disparities with confidence value under this threshold are accepted. Higher confidence threshold means disparities with less confidence are accepted too.

LinearEquationParameters linearEquationParameters

Cost calculation linear equation parameters.

struct LinearEquationParameters
#include <RawStereoDepthConfig.hpp>

The linear equation applied for computing the cost is: COMB_COST = α*AD + β*(CTC<<3). CLAMP(COMB_COST >> 5, threshold). Where AD is the Absolute Difference between 2 pixels values. CTC is the Census Transform Cost between 2 pixels, based on Hamming distance (xor). The α and β parameters are subject to fine fine tuning by the user.

struct PostProcessing

Public Members

MedianFilter median = MedianFilter::KERNEL_5x5

Set kernel size for disparity/depth median filtering, or disable

std::int16_t bilateralSigmaValue = 0

Sigma value for bilateral filter. 0 means disabled A larger value of the parameter means that farther colors within the pixel neighborhood will be mixed together.

struct RawSystemInformation : public dai::RawBuffer
#include <RawSystemInformation.hpp>

System information of device

Memory usage, cpu usage and chip temperature

Public Members

MemoryInfo ddrMemoryUsage

DDR memory usage.

MemoryInfo cmxMemoryUsage

CMX memory usage.

MemoryInfo leonCssMemoryUsage

LeonCss heap usage.

MemoryInfo leonMssMemoryUsage

LeonMss heap usage.

CpuUsage leonCssCpuUsage

LeonCss cpu usage.

CpuUsage leonMssCpuUsage

LeonMss cpu usage.

ChipTemperature chipTemperature

Chip temperatures.

struct RawTrackedFeatures : public dai::RawBuffer
#include <RawTrackedFeatures.hpp>

RawTrackedFeatures structure.

struct RawTracklets : public dai::RawBuffer
#include <RawTracklets.hpp>

RawTracklets structure.

struct Rect
#include <Rect.hpp>

Rect structure

x,y coordinates together with width and height that define a rectangle. Can be either normalized [0,1] or absolute representation.

Public Functions

Point2f topLeft() const

The top-left corner.

Point2f bottomRight() const

The bottom-right corner

Size2f size() const

Size (width, height) of the rectangle

float area() const

Area (width*height) of the rectangle

bool empty() const

True if rectangle is empty.

bool contains(const Point2f &pt) const

Checks whether the rectangle contains the point.

bool isNormalized() const

Whether rectangle is normalized (coordinates in [0,1] range) or not.

Rect denormalize(int width, int height)

Denormalize rectangle.

Parameters
  • width: Destination frame width.

  • height: Destination frame height.

Rect normalize(int width, int height)

Normalize rectangle.

Parameters
  • width: Source frame width.

  • height: Source frame height.

struct RotatedRect
#include <RotatedRect.hpp>

RotatedRect structure.

Public Members

float angle

degrees, increasing clockwise

struct ScriptProperties
#include <ScriptProperties.hpp>

Specify ScriptProperties options such as script uri, script name, …

Public Members

std::string scriptUri = ""

Uri which points to actual script

std::string scriptName = "<script>"

Name of script

ProcessorType processor = ProcessorType::LEON_MSS

Which processor should execute the script

struct Size2f
#include <Size2f.hpp>

Size2f structure

width, height values define the size of the shape/frame

struct SpatialDetectionNetworkProperties : public dai::DetectionNetworkProperties
#include <SpatialDetectionNetworkProperties.hpp>

Specify properties for SpatialDetectionNetwork

struct SpatialImgDetection : public dai::ImgDetection
#include <RawSpatialImgDetections.hpp>

SpatialImgDetection structure

Contains image detection results together with spatial location data.

class SpatialImgDetections : public dai::Buffer
#include <SpatialImgDetections.hpp>

SpatialImgDetections message. Carries detection results together with spatial location data

Public Functions

SpatialImgDetections()

Construct SpatialImgDetections message.

Public Members

std::vector<SpatialImgDetection> &detections

Detection results.

class SpatialLocationCalculatorConfig : public dai::Buffer
#include <SpatialLocationCalculatorConfig.hpp>

SpatialLocationCalculatorConfig message. Carries ROI (region of interest) and threshold for depth calculation

Public Functions

SpatialLocationCalculatorConfig()

Construct SpatialLocationCalculatorConfig message.

void setROIs(std::vector<SpatialLocationCalculatorConfigData> ROIs)

Set a vector of ROIs as configuration data.

Parameters
  • ROIs: Vector of configuration parameters for ROIs (region of interests)

void addROI(SpatialLocationCalculatorConfigData &ROI)

Add a new ROI to configuration data.

Parameters
  • roi: Configuration parameters for ROI (region of interest)

std::vector<SpatialLocationCalculatorConfigData> getConfigData() const

Retrieve configuration data for SpatialLocationCalculator

Return

Vector of configuration parameters for ROIs (region of interests)

struct SpatialLocationCalculatorConfigData
#include <RawSpatialLocationCalculatorConfig.hpp>

SpatialLocation configuration data structure.

Public Members

Rect roi

Region of interest for spatial location calculation.

SpatialLocationCalculatorConfigThresholds depthThresholds

Upper and lower thresholds for depth values to take into consideration.

SpatialLocationCalculatorAlgorithm calculationAlgorithm = SpatialLocationCalculatorAlgorithm::AVERAGE

Calculation method used to obtain spatial locations. Average: the average of ROI is used for calculation. Min: the minimum value inside ROI is used for calculation. Max: the maximum value inside ROI is used for calculation. Default: average.

struct SpatialLocationCalculatorConfigThresholds
#include <RawSpatialLocationCalculatorConfig.hpp>

SpatialLocation configuration thresholds structure

Contains configuration data for lower and upper threshold in millimeters for ROI. Values outside of threshold range will be ignored when calculating spatial coordinates from depth map.

class SpatialLocationCalculatorData : public dai::Buffer
#include <SpatialLocationCalculatorData.hpp>

SpatialLocationCalculatorData message. Carries spatial information (X,Y,Z) and their configuration parameters

Public Functions

SpatialLocationCalculatorData()

Construct SpatialLocationCalculatorData message.

std::vector<SpatialLocations> &getSpatialLocations() const

Retrieve configuration data for SpatialLocationCalculatorData.

Return

Vector of spatial location data, carrying spatial information (X,Y,Z)

struct SpatialLocationCalculatorProperties
#include <SpatialLocationCalculatorProperties.hpp>

Specify properties for SpatialLocationCalculator

Public Members

bool inputConfigSync = false

Whether to wait for config at ‘inputConfig’ IO.

struct SpatialLocations
#include <RawSpatialLocations.hpp>

SpatialLocations structure

Contains configuration data, average depth for the calculated ROI on depth map. Together with spatial coordinates: x,y,z relative to the center of depth map. Units are in millimeters.

Public Members

SpatialLocationCalculatorConfigData config

Configuration for selected ROI

float depthAverage

Average of depth values inside the ROI between the specified thresholds in config

std::uint16_t depthMin

Minimum of depth values inside the ROI between the specified thresholds in config

std::uint16_t depthMax

Maximum of depth values inside the ROI between the specified thresholds in config

std::uint32_t depthAveragePixelCount

Number of depth values used to calculate depthAverage based on config

Point3f spatialCoordinates

Spatial coordinates: x,y,z; x,y are the relative positions of the center of ROI to the center of depth map

struct SPIInProperties
#include <SPIInProperties.hpp>

Properties for SPIIn node

Public Members

std::string streamName

Name of stream

int busId = 0

SPI bus to use

std::uint32_t maxDataSize = dai::device::XLINK_USB_BUFFER_MAX_SIZE

Maximum input data size

std::uint32_t numFrames = 4

Number of frames in pool

struct SPIOutProperties
#include <SPIOutProperties.hpp>

Specify properties for SPIOut node

Public Members

std::string streamName

Name of stream

int busId = 0

SPI bus to use

class StereoDepthConfig : public dai::Buffer
#include <StereoDepthConfig.hpp>

StereoDepthConfig message.

Public Functions

StereoDepthConfig()

Construct StereoDepthConfig message.

void setConfidenceThreshold(int confThr)

Confidence threshold for disparity calculation

Parameters
  • confThr: Confidence threshold value 0..255

int getConfidenceThreshold() const

Get confidence threshold for disparity calculation

void setMedianFilter(dai::MedianFilter median)

Parameters
  • median: Set kernel size for disparity/depth median filtering, or disable

dai::MedianFilter getMedianFilter() const

Get median filter setting

void setBilateralFilterSigma(uint16_t sigma)

A larger value of the parameter means that farther colors within the pixel neighborhood will be mixed together, resulting in larger areas of semi-equal color.

Parameters
  • sigma: Set sigma value for 5x5 bilateral filter. 0..65535

uint16_t getBilateralFilterSigma() const

Get sigma value for 5x5 bilateral filter

void setLeftRightCheckThreshold(int threshold)

Parameters
  • threshold: Set threshold for left-right, right-left disparity map combine, 0..255

int getLeftRightCheckThreshold() const

Get threshold for left-right check combine

void setLeftRightCheck(bool enable)

Computes and combines disparities in both L-R and R-L directions, and combine them.

For better occlusion handling, discarding invalid disparity values

void setExtendedDisparity(bool enable)

Disparity range increased from 95 to 190, combined from full resolution and downscaled images. Suitable for short range objects

void setSubpixel(bool enable)

Computes disparity with sub-pixel interpolation (5 fractional bits).

Suitable for long range. Currently incompatible with extended disparity

float getMaxDisparity() const

Useful for normalization of the disparity map.

Return

Maximum disparity value that the node can return

void set(dai::RawStereoDepthConfig config)

Set explicit configuration.

Parameters
  • config: Explicit configuration

dai::RawStereoDepthConfig get() const

Retrieve configuration data for StereoDepth.

Return

config for stereo depth algorithm

struct StereoDepthProperties
#include <StereoDepthProperties.hpp>

Specify properties for StereoDepth

Public Types

enum DepthAlign

Align the disparity/depth to the perspective of a rectified output, or center it

Values:

enumerator RECTIFIED_RIGHT
enumerator RECTIFIED_LEFT
enumerator CENTER

Public Members

RawStereoDepthConfig initialConfig

Initial stereo config.

bool inputConfigSync = false

Whether to wait for config at ‘inputConfig’ IO.

DepthAlign depthAlign = DepthAlign::RECTIFIED_RIGHT

Set the disparity/depth alignment to the perspective of a rectified output, or center it

CameraBoardSocket depthAlignCamera = CameraBoardSocket::AUTO

Which camera to align disparity/depth to. When configured (not AUTO), takes precedence over ‘depthAlign’

std::int32_t rectifyEdgeFillColor = -1

Fill color for missing data at frame edges: grayscale 0..255, or -1 to replicate pixels

tl::optional<std::int32_t> width

Input frame width. Optional (taken from MonoCamera nodes if they exist)

tl::optional<std::int32_t> height

Input frame height. Optional (taken from MonoCamera nodes if they exist)

tl::optional<std::int32_t> outWidth

Output disparity/depth width. Currently only used when aligning to RGB

tl::optional<std::int32_t> outHeight

Output disparity/depth height. Currently only used when aligning to RGB

bool outKeepAspectRatio = true

Whether to keep aspect ratio of the input (rectified) or not

RectificationMesh mesh

Specify a direct warp mesh to be used for rectification, instead of intrinsics + extrinsic matrices

bool enableRuntimeStereoModeSwitch = false

Whether to enable switching stereo modes at runtime or not. E.g. standard to subpixel, standard+LR-check to subpixel + LR-check. Note: It will allocate resources for worst cases scenario, should be enabled only if dynamic mode switch is required. Default value: false.

int numFramesPool = 3

Num frames in output pool.

struct RectificationMesh

Public Members

std::string meshLeftUri

Uri which points to the mesh array for ‘left’ input rectification

std::string meshRightUri

Uri which points to the mesh array for ‘right’ input rectification

tl::optional<std::uint32_t> meshSize

Mesh array size in bytes, for each of ‘left’ and ‘right’ (need to match)

uint16_t stepWidth = 16

Distance between mesh points, in the horizontal direction

uint16_t stepHeight = 16

Distance between mesh points, in the vertical direction

struct StereoRectification
#include <StereoRectification.hpp>

StereoRectification structure.

class StreamMessageParser
class SystemInformation : public dai::Buffer
#include <SystemInformation.hpp>

SystemInformation message. Carries memory usage, cpu usage and chip temperatures.

Public Functions

SystemInformation()

Construct SystemInformation message.

struct SystemLoggerProperties
#include <SystemLoggerProperties.hpp>

SystemLoggerProperties structure

Public Members

float rateHz = 1.0f

Rate at which the messages are going to be sent in hertz

struct TensorInfo
#include <RawNNData.hpp>

TensorInfo structure.

struct Timestamp
#include <Timestamp.hpp>

Timestamp structure.

struct TrackedFeature
#include <RawTrackedFeatures.hpp>

TrackedFeature structure

Public Members

Point2f position

x, y position of the detected feature

uint32_t id

Feature ID. Persistent between frames if motion estimation is enabled.

class TrackedFeatures : public dai::Buffer
#include <TrackedFeatures.hpp>

TrackedFeatures message. Carries position (X, Y) of tracked features and their ID.

Public Functions

TrackedFeatures()

Construct TrackedFeatures message.

struct Tracklet
#include <RawTracklets.hpp>

Tracklet structure

Contains tracklets from object tracker output.

Public Members

Rect roi

Tracked region of interest.

std::int32_t id

Tracklet’s ID.

std::int32_t label

Tracklet’s label ID.

std::int32_t age

Number of frames it is being tracked for.

TrackingStatus status

Status of tracklet.

ImgDetection srcImgDetection

Image detection that is tracked.

Point3f spatialCoordinates

Spatial coordinates of tracklet.

class Tracklets : public dai::Buffer
#include <Tracklets.hpp>

Tracklets message. Carries object tracking information.

Public Functions

Tracklets()

Construct Tracklets message.

Public Members

std::vector<Tracklet> &tracklets

Retrieve data for Tracklets.

Return

Vector of object tracker data, carrying tracking information.

struct VideoEncoderProperties
#include <VideoEncoderProperties.hpp>

Specify properties for VideoEncoder such as profile, bitrate, …

Public Types

enum RateControlMode

Rate control mode specifies if constant or variable bitrate should be used (H264 / H265)

Values:

enumerator CBR
enumerator VBR
enum Profile

Encoding profile, H264 (AVC), H265 (HEVC) or MJPEG

Values:

enumerator H264_BASELINE
enumerator H264_HIGH
enumerator H264_MAIN
enumerator H265_MAIN
enumerator MJPEG

Public Members

std::int32_t bitrate = 0

Specifies preferred bitrate (in bit/s) of compressed output bitstream in CBR mode

“0” for automatic computation, based on input resolution and FPS: 720p30: 4Mbps, 1080p30: 8.5Mbps, 1440p30: 14Mbps, 2160p30: 20Mbps

std::int32_t keyframeFrequency = 30

Every x number of frames a keyframe will be inserted

std::int32_t maxBitrate = 0

Specifies maximum bitrate (in bit/s) of compressed output bitstream in CBR mode

“0” to follow bitrate setting

std::int32_t numBFrames = 0

Specifies number of B frames to be inserted

std::uint32_t numFramesPool = 0

This options specifies how many frames are available in this node’s pool. Helps when receiver is slow at consuming.

Value “0” indicates automatic number of frames assignment

Profile profile = Profile::H264_BASELINE

Encoding profile, H264, H265 or MJPEG

std::int32_t quality = 80

Value between 0-100% (approximates quality)

bool lossless = false

Lossless mode ([M]JPEG only)

RateControlMode rateCtrlMode = RateControlMode::CBR

Rate control mode specifies if constant or variable bitrate should be used (H264 / H265)

float frameRate = 30.0f

Frame rate

class XLinkConnection
#include <XLinkConnection.hpp>

Represents connection between host and device over XLink protocol

Public Functions

void close()

Explicitly closes xlink connection.

Note

This function does not need to be explicitly called as destructor closes the connection automatically

bool isClosed() const

Is the connection already closed (or disconnected)

struct XLinkError : public runtime_error

Subclassed by dai::XLinkReadError, dai::XLinkWriteError

struct XLinkInProperties
#include <XLinkInProperties.hpp>

Specify properties for XLinkIn such as stream name, …

Public Members

std::string streamName

Name of stream

std::uint32_t maxDataSize = dai::device::XLINK_USB_BUFFER_MAX_SIZE

Maximum input data size

std::uint32_t numFrames = 8

Number of frames in pool

struct XLinkOutProperties
#include <XLinkOutProperties.hpp>

Specify properties for XLinkOut such as stream name, …

Public Members

float maxFpsLimit = -1

Set a limit to how many packets will be sent further to host

std::string streamName

Name of stream

bool metadataOnly = false

Whether to transfer data or only object attributes

struct XLinkReadError : public dai::XLinkError
class XLinkStream
struct XLinkWriteError : public dai::XLinkError
namespace bootloader

Enums

enum Memory

Values:

enumerator AUTO
enumerator FLASH
enumerator EMMC
enum Section

Values:

enumerator AUTO
enumerator HEADER
enumerator BOOTLOADER
enumerator BOOTLOADER_CONFIG
enumerator APPLICATION
enum Type

Values:

enumerator AUTO
enumerator USB
enumerator NETWORK

Functions

DEPTHAI_BOOTLOADER_NLOHMANN_DEFINE_TYPE_OPTIONAL_NON_INTRUSIVE(NetworkConfig, timeoutMs, ipv4, ipv4Mask, ipv4Gateway, ipv4Dns, ipv4DnsAlt, staticIpv4, ipv6, ipv6Prefix, ipv6Gateway, ipv6Dns, ipv6DnsAlt, staticIpv6, mac)
DEPTHAI_BOOTLOADER_NLOHMANN_DEFINE_TYPE_OPTIONAL_NON_INTRUSIVE(UsbConfig, timeoutMs, maxUsbSpeed, vid, pid)
DEPTHAI_BOOTLOADER_NLOHMANN_DEFINE_TYPE_OPTIONAL_NON_INTRUSIVE(Config, appMem, usb, network)
const Structure getStructure(Type type)

Variables

struct Config

Subclassed by dai::DeviceBootloader::Config

struct NetworkBootloaderStructure : public dai::bootloader::Structure
struct NetworkConfig

Public Members

int timeoutMs = 30000

If timeout < 0 - waits forever if timeout == 0 - no timeout if timeout > 0 - waits timeout milliseconds

struct Structure

Subclassed by dai::bootloader::NetworkBootloaderStructure, dai::bootloader::UsbBootloaderStructure

struct UsbBootloaderStructure : public dai::bootloader::Structure
struct UsbConfig

Public Members

int timeoutMs = 3000

If timeout < 0 - waits forever if timeout == 0 - no timeout if timeout > 0 - waits timeout milliseconds

int maxUsbSpeed = 3

UNKNOWN = 0, LOW, FULL, HIGH, SUPER, SUPER_PLUS

uint16_t vid = 0x03E7

VID/PID pair used by bootloader.

namespace request

Enums

enum Command

Values:

enumerator USB_ROM_BOOT
enumerator BOOT_APPLICATION
enumerator UPDATE_FLASH
enumerator GET_BOOTLOADER_VERSION
enumerator BOOT_MEMORY
enumerator UPDATE_FLASH_EX
enumerator UPDATE_FLASH_EX_2
enumerator NO_OP
enumerator GET_BOOTLOADER_TYPE
enumerator SET_BOOTLOADER_CONFIG
enumerator GET_BOOTLOADER_CONFIG
enumerator BOOTLOADER_MEMORY
struct BaseRequest

Subclassed by dai::bootloader::request::BootApplication, dai::bootloader::request::BootloaderMemory, dai::bootloader::request::BootMemory, dai::bootloader::request::GetBootloaderConfig, dai::bootloader::request::GetBootloaderType, dai::bootloader::request::GetBootloaderVersion, dai::bootloader::request::SetBootloaderConfig, dai::bootloader::request::UpdateFlash, dai::bootloader::request::UpdateFlashEx, dai::bootloader::request::UpdateFlashEx2, dai::bootloader::request::UsbRomBoot

struct BootApplication : public dai::bootloader::request::BaseRequest
struct BootloaderMemory : public dai::bootloader::request::BaseRequest
struct BootMemory : public dai::bootloader::request::BaseRequest
struct GetBootloaderConfig : public dai::bootloader::request::BaseRequest
struct GetBootloaderType : public dai::bootloader::request::BaseRequest
struct GetBootloaderVersion : public dai::bootloader::request::BaseRequest
struct SetBootloaderConfig : public dai::bootloader::request::BaseRequest
struct UpdateFlash : public dai::bootloader::request::BaseRequest
struct UpdateFlashEx : public dai::bootloader::request::BaseRequest
struct UpdateFlashEx2 : public dai::bootloader::request::BaseRequest
struct UsbRomBoot : public dai::bootloader::request::BaseRequest
namespace response

Enums

enum Command

Values:

enumerator FLASH_COMPLETE
enumerator FLASH_STATUS_UPDATE
enumerator BOOTLOADER_VERSION
enumerator BOOTLOADER_TYPE
enumerator GET_BOOTLOADER_CONFIG
enumerator BOOTLOADER_MEMORY
enumerator BOOT_APPLICATION
struct BaseResponse

Subclassed by dai::bootloader::response::BootApplication, dai::bootloader::response::BootloaderMemory, dai::bootloader::response::BootloaderType, dai::bootloader::response::BootloaderVersion, dai::bootloader::response::FlashComplete, dai::bootloader::response::FlashStatusUpdate, dai::bootloader::response::GetBootloaderConfig

struct BootApplication : public dai::bootloader::response::BaseResponse
struct BootloaderMemory : public dai::bootloader::response::BaseResponse
struct BootloaderType : public dai::bootloader::response::BaseResponse
struct BootloaderVersion : public dai::bootloader::response::BaseResponse
struct FlashComplete : public dai::bootloader::response::BaseResponse
struct FlashStatusUpdate : public dai::bootloader::response::BaseResponse
struct GetBootloaderConfig : public dai::bootloader::response::BaseResponse
namespace device

Variables

namespace node
class ColorCamera : public dai::Node
#include <ColorCamera.hpp>

ColorCamera node. For use with color sensors.

Public Functions

std::string getName() const override

Retrieves nodes name.

ColorCamera(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId)

Constructs ColorCamera node.

void setBoardSocket(CameraBoardSocket boardSocket)

Specify which board socket to use

Parameters
  • boardSocket: Board socket to use

CameraBoardSocket getBoardSocket() const

Retrieves which board socket to use

Return

Board socket to use

void setCamId(int64_t id)

Set which color camera to use.

int64_t getCamId() const

Get which color camera to use.

void setImageOrientation(CameraImageOrientation imageOrientation)

Set camera image orientation.

CameraImageOrientation getImageOrientation() const

Get camera image orientation.

void setColorOrder(ColorCameraProperties::ColorOrder colorOrder)

Set color order of preview output images. RGB or BGR.

ColorCameraProperties::ColorOrder getColorOrder() const

Get color order of preview output frames. RGB or BGR.

void setInterleaved(bool interleaved)

Set planar or interleaved data of preview output frames.

bool getInterleaved() const

Get planar or interleaved data of preview output frames.

void setFp16(bool fp16)

Set fp16 (0..255) data type of preview output frames.

bool getFp16() const

Get fp16 (0..255) data of preview output frames.

void setPreviewSize(int width, int height)

Set preview output size.

void setPreviewSize(std::tuple<int, int> size)

Set preview output size, as a tuple <width, height>

void setVideoSize(int width, int height)

Set video output size.

void setVideoSize(std::tuple<int, int> size)

Set video output size, as a tuple <width, height>

void setStillSize(int width, int height)

Set still output size.

void setStillSize(std::tuple<int, int> size)

Set still output size, as a tuple <width, height>

void setResolution(Properties::SensorResolution resolution)

Set sensor resolution.

Properties::SensorResolution getResolution() const

Get sensor resolution.

void setIspScale(int numerator, int denominator)

Set ‘isp’ output scaling (numerator/denominator), preserving the aspect ratio. The fraction numerator/denominator is simplified first to a irreducible form, then a set of hardware scaler constraints applies: max numerator = 16, max denominator = 63

void setIspScale(std::tuple<int, int> scale)

Set ‘isp’ output scaling, as a tuple <numerator, denominator>

void setIspScale(int horizNum, int horizDenom, int vertNum, int vertDenom)

Set ‘isp’ output scaling, per each direction. If the horizontal scaling factor (horizNum/horizDen) is different than the vertical scaling factor (vertNum/vertDen), a distorted (stretched or squished) image is generated

void setIspScale(std::tuple<int, int> horizScale, std::tuple<int, int> vertScale)

Set ‘isp’ output scaling, per each direction, as <numerator, denominator> tuples.

void setFps(float fps)

Set rate at which camera should produce frames

Parameters
  • fps: Rate in frames per second

float getFps() const

Get rate at which camera should produce frames

Return

Rate in frames per second

std::tuple<int, int> getPreviewSize() const

Get preview size as tuple.

int getPreviewWidth() const

Get preview width.

int getPreviewHeight() const

Get preview height.

std::tuple<int, int> getVideoSize() const

Get video size as tuple.

int getVideoWidth() const

Get video width.

int getVideoHeight() const

Get video height.

std::tuple<int, int> getStillSize() const

Get still size as tuple.

int getStillWidth() const

Get still width.

int getStillHeight() const

Get still height.

std::tuple<int, int> getResolutionSize() const

Get sensor resolution as size.

int getResolutionWidth() const

Get sensor resolution width.

int getResolutionHeight() const

Get sensor resolution height.

std::tuple<int, int> getIspSize() const

Get ‘isp’ output resolution as size, after scaling.

int getIspWidth() const

Get ‘isp’ output width.

int getIspHeight() const

Get ‘isp’ output height.

void sensorCenterCrop()

Specify sensor center crop. Resolution size / video size

void setSensorCrop(float x, float y)

Specifies sensor crop rectangle

Parameters
  • x: Top left X coordinate

  • y: Top left Y coordinate

std::tuple<float, float> getSensorCrop() const

Return

Sensor top left crop coordinates

float getSensorCropX() const

Get sensor top left x crop coordinate.

float getSensorCropY() const

Get sensor top left y crop coordinate.

void setWaitForConfigInput(bool wait)

Specify to wait until inputConfig receives a configuration message, before sending out a frame.

Parameters
  • wait: True to wait for inputConfig message, false otherwise

bool getWaitForConfigInput()

See

setWaitForConfigInput

Return

True if wait for inputConfig message, false otherwise

void setPreviewKeepAspectRatio(bool keep)

Specifies whether preview output should preserve aspect ratio, after downscaling from video size or not.

Parameters
  • keep: If true, a larger crop region will be considered to still be able to create the final image in the specified aspect ratio. Otherwise video size is resized to fit preview size

bool getPreviewKeepAspectRatio()

See

setPreviewKeepAspectRatio

Return

Preview keep aspect ratio option

Public Members

CameraControl initialControl

Initial control options to apply to sensor

Input inputConfig = {*this, "inputConfig", Input::Type::SReceiver, false, 8, {{DatatypeEnum::ImageManipConfig, false}}}

Input for ImageManipConfig message, which can modify crop paremeters in runtime

Default queue is non-blocking with size 8

Input inputControl = {*this, "inputControl", Input::Type::SReceiver, true, 8, {{DatatypeEnum::CameraControl, false}}}

Input for CameraControl message, which can modify camera parameters in runtime

Default queue is blocking with size 8

Output video = {*this, "video", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs ImgFrame message that carries NV12 encoded (YUV420, UV plane interleaved) frame data.

Suitable for use with VideoEncoder node

Output preview = {*this, "preview", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs ImgFrame message that carries BGR/RGB planar/interleaved encoded frame data.

Suitable for use with NeuralNetwork node

Output still = {*this, "still", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs ImgFrame message that carries NV12 encoded (YUV420, UV plane interleaved) frame data.

The message is sent only when a CameraControl message arrives to inputControl with captureStill command set.

Output isp = {*this, "isp", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs ImgFrame message that carries YUV420 planar (I420/IYUV) frame data.

Generated by the ISP engine, and the source for the ‘video’, ‘preview’ and ‘still’ outputs

Output raw = {*this, "raw", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs ImgFrame message that carries RAW10-packed (MIPI CSI-2 format) frame data.

Captured directly from the camera sensor, and the source for the ‘isp’ output.

class DetectionNetwork : public dai::node::NeuralNetwork
#include <DetectionNetwork.hpp>

DetectionNetwork, base for different network specializations.

Subclassed by dai::node::MobileNetDetectionNetwork, dai::node::SpatialDetectionNetwork, dai::node::YoloDetectionNetwork

Public Functions

std::string getName() const override

Retrieves nodes name.

void setConfidenceThreshold(float thresh)

Specifies confidence threshold at which to filter the rest of the detections.

Parameters
  • thresh: Detection confidence must be greater than specified threshold to be added to the list

Public Members

Input input = {*this, "in", Input::Type::SReceiver, true, 5, {{DatatypeEnum::Buffer, true}}}

Input message with data to be infered upon Default queue is blocking with size 5

Output out = {*this, "out", Output::Type::MSender, {{DatatypeEnum::ImgDetections, false}}}

Outputs ImgDetections message that carries parsed detection results.

Output passthrough = {*this, "passthrough", Output::Type::MSender, {{DatatypeEnum::Buffer, true}}}

Passthrough message on which the inference was performed.

Suitable for when input queue is set to non-blocking behavior.

class EdgeDetector : public dai::Node
#include <EdgeDetector.hpp>

EdgeDetector node. Performs edge detection using 3x3 Sobel filter.

Public Functions

void setWaitForConfigInput(bool wait)

Specify whether or not wait until configuration message arrives to inputConfig Input.

Parameters
  • wait: True to wait for configuration message, false otherwise.

void setNumFramesPool(int numFramesPool)

Specify number of frames in pool.

Parameters
  • numFramesPool: How many frames should the pool have

void setMaxOutputFrameSize(int maxFrameSize)

Specify maximum size of output image.

Parameters
  • maxFrameSize: Maximum frame size in bytes

Public Members

EdgeDetectorConfig initialConfig

Initial config to use for edge detection.

Input inputConfig = {*this, "inputConfig", Input::Type::SReceiver, false, 4, {{DatatypeEnum::EdgeDetectorConfig, false}}}

Input EdgeDetectorConfig message with ability to modify parameters in runtime. Default queue is non-blocking with size 4.

Input inputImage = {*this, "inputImage", Input::Type::SReceiver, false, 4, {{DatatypeEnum::ImgFrame, false}}}

Input image on which edge detection is performed. Default queue is non-blocking with size 4.

Output outputImage = {*this, "outputImage", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Outputs image frame with detected edges

Output passthroughInputImage = {*this, "passthroughInputImage", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Passthrough message on which the calculation was performed.

class FeatureTracker : public dai::Node
#include <FeatureTracker.hpp>

FeatureTracker node. Performs feature tracking and reidentification using motion estimation between 2 consecutive frames.

Public Functions

void setWaitForConfigInput(bool wait)

Specify whether or not wait until configuration message arrives to inputConfig Input.

Parameters
  • wait: True to wait for configuration message, false otherwise.

void setHardwareResources(int numShaves, int numMemorySlices)

Specify allocated hardware resources for feature tracking. 2 shaves/memory slices are required for optical flow, 1 for corner detection only.

Parameters
  • numShaves: Number of shaves. Maximum 2.

  • numMemorySlices: Number of memory slices. Maximum 2.

Public Members

FeatureTrackerConfig initialConfig

Initial config to use for feature tracking.

Input inputConfig = {*this, "inputConfig", Input::Type::SReceiver, false, 4, {{DatatypeEnum::FeatureTrackerConfig, false}}}

Input FeatureTrackerConfig message with ability to modify parameters in runtime. Default queue is non-blocking with size 4.

Input inputImage = {*this, "inputImage", Input::Type::SReceiver, false, 4, {{DatatypeEnum::ImgFrame, false}}}

Input message with frame data on which feature tracking is performed. Default queue is non-blocking with size 4.

Output outputFeatures = {*this, "outputFeatures", Output::Type::MSender, {{DatatypeEnum::TrackedFeatures, false}}}

Outputs TrackedFeatures message that carries tracked features results.

Output passthroughInputImage = {*this, "passthroughInputImage", Output::Type::MSender, {{DatatypeEnum::ImgFrame, false}}}

Passthrough message on which the calculation was performed. Suitable for when input queue is set to non-blocking behavior.

class ImageManip : public dai::Node
#include <ImageManip.hpp>

ImageManip node. Capability to crop, resize, warp, … incoming image frames.

Public Functions

std::string getName() const override

Retrieves nodes name.

void setWaitForConfigInput(bool wait)

Specify whether or not wait until configuration message arrives to inputConfig Input.

Parameters
  • wait: True to wait for configuration message, false otherwise

void setNumFramesPool(int numFramesPool)

Specify number of frames in pool.

Parameters
  • numFramesPool: How many frames should the pool have

void setMaxOutputFrameSize(int maxFrameSize)

Specify maximum size of output image.

Parameters
  • maxFrameSize: Maximum frame size in bytes

Public Members

ImageManipConfig initialConfig

Initial config to use when manipulating frames

Input inputConfig = {*this, "inputConfig", Input::Type::SReceiver, true, 8, {{DatatypeEnum::ImageManipConfig, true}}}

Input ImageManipConfig message with ability to modify parameters in runtime Default queue is blocking with size 8

Input inputImage = {*this, "inputImage", Input::Type::SReceiver, true, 8, {{DatatypeEnum::ImgFrame, true}}}

Input image to be modified Default queue is blocking with size 8

Output out = {*this, "out", Output::Type::MSender, {{DatatypeEnum::ImgFrame, true}}}

Outputs ImgFrame message that carries modified image.

class IMU : public dai::Node
#include <IMU.hpp>

IMU node for BNO08X.

Public Functions

std::string getName() const override

Retrieves nodes name.

IMU(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId)

Constructs IMU node.

void enableIMUSensor(IMUSensorConfig sensorConfig)

Enable a new IMU sensor with explicit configuration

void enableIMUSensor(const std::vector<IMUSensorConfig> &sensorConfigs)

Enable a list of IMU sensors with explicit configuration

void enableIMUSensor(IMUSensor sensor, uint32_t reportRate)

Enable a new IMU sensor with default configuration

void enableIMUSensor(const std::vector<IMUSensor> &sensors, uint32_t reportRate)

Enable a list of