Data Types

The value types, containers and utility types used throughout the Zivid SDK API. These are the building blocks returned and consumed by the camera, capture and processing APIs.

For the exhaustive per-type reference, see the Zivid API documentation.

Geometry

Per-point geometry types: 3D points, a 2D point, a depth-only point, a vector and a 2D bounding box in image coordinates.

struct PointXYZ

Point with three coordinates as float.

Public Types

using ValueType = float

The type of the coordinate values.

Public Functions

PointXYZ() = default

Constructor.

inline constexpr PointXYZ(float xCoord, float yCoord, float zCoord)

Constructor.

inline bool isNaN() const

Check if the point is Not-a-Number (invalid)

A point is defined as NaN if the z-coordinate is NaN

ZIVID_UTILS_EXPORT std::string toString () const

Get string representation.

ZIVID_UTILS_EXPORT bool operator== (const PointXYZ &rhs) const

Check for equality.

ZIVID_UTILS_EXPORT bool operator!= (const PointXYZ &rhs) const

Check for inequality.

Public Members

ValueType x

The x element of the point.

ValueType y

The y element of the point.

ValueType z

The z element of the point.

struct PointXYZW

Point with four coordinates as float.

Storing the point coordinates in 4D can be useful in some scenarios. For example if the points are to be passed to a different library which expects 4 floats for point coordinates. It is also useful when applying 4x4 transformation matrices.

Public Types

using ValueType = float

The type of the coordinate values.

Public Functions

PointXYZW() = default

Constructor.

inline PointXYZW(float xCoord, float yCoord, float zCoord, float wCoord)

Constructor.

inline bool isNaN() const

Check if the point is Not-a-Number (invalid)

A point is defined as NaN if the z-coordinate is NaN

ZIVID_UTILS_EXPORT std::string toString () const

Get string representation.

ZIVID_UTILS_EXPORT bool operator== (const PointXYZW &rhs) const

Check for equality.

ZIVID_UTILS_EXPORT bool operator!= (const PointXYZW &rhs) const

Check for inequality.

Public Members

ValueType x

The x element of the point.

ValueType y

The y element of the point.

ValueType z

The z element of the point.

ValueType w

The w element of the point.

struct PointXY

Point with two coordinates as float.

Public Types

using ValueType = float

The type of the coordinate values.

Public Functions

PointXY() = default

Constructor.

inline constexpr PointXY(float xCoord, float yCoord)

Constructor.

inline bool isNaN() const

Check if the point is Not-a-Number (invalid)

A point is defined as NaN if the y-coordinate is NaN

ZIVID_UTILS_EXPORT std::string toString () const

Get string representation.

ZIVID_UTILS_EXPORT bool operator== (const PointXY &rhs) const

Check for equality.

ZIVID_UTILS_EXPORT bool operator!= (const PointXY &rhs) const

Check for inequality.

Public Members

ValueType x

The x element of the point.

ValueType y

The y element of the point.

struct PointZ

Point with Z coordinate.

Public Types

using ValueType = float

The type of the coordinate values.

Public Functions

PointZ() = default

Constructor.

inline PointZ(float zCoord)

Constructor.

inline bool isNaN() const

Check if the point is Not-a-Number (invalid)

ZIVID_UTILS_EXPORT std::string toString () const

Get string representation.

ZIVID_UTILS_EXPORT bool operator== (const PointZ &rhs) const

Check for equality.

ZIVID_UTILS_EXPORT bool operator!= (const PointZ &rhs) const

Check for inequality.

Public Members

ValueType z

The z element of the point.

struct VectorXYZ

Vector with three coordinates as float.

Subclassed by Zivid::NormalXYZ

Public Types

using ValueType = float

The type of the coordinate values.

Public Functions

VectorXYZ() = default

Constructor.

inline VectorXYZ(float xCoord, float yCoord, float zCoord)

Constructor.

inline bool isNaN() const

Check if the vector is Not-a-Number (invalid)

A vector is defined as NaN if the z-coordinate is NaN

ZIVID_UTILS_EXPORT std::string toString () const

Get string representation.

ZIVID_UTILS_EXPORT bool operator== (const VectorXYZ &rhs) const

Check for equality.

ZIVID_UTILS_EXPORT bool operator!= (const VectorXYZ &rhs) const

Check for inequality.

Public Members

ValueType x

The x element of the vector.

ValueType y

The y element of the vector.

ValueType z

The z element of the vector.

struct BoundingBox

Defines a 2D rectangular bounding box in image coordinates.

Public Types

using ValueType = int

summary>Constructor

Public Functions

inline constexpr BoundingBox(int xCoord, int yCoord, int boxWidth, int boxHeight)

Constructor.

ZIVID_UTILS_EXPORT std::string toString () const

Get string representation.

ZIVID_UTILS_EXPORT bool operator== (const BoundingBox &rhs) const

Check for equality.

ZIVID_UTILS_EXPORT bool operator!= (const BoundingBox &rhs) const

Check for inequality.

Public Members

ValueType x

Top-left corner x coordinate.

ValueType y

Top-left corner y coordinate.

ValueType width

Width of the bounding box.

ValueType height

Height of the bounding box.

struct PointXYZ

Point with three coordinates as float.

struct PointXYZW

Point with four coordinates as float (homogeneous coordinates)

struct PointXY

Point with two coordinates as float.

struct PointZ

Point with only the Z coordinate as float.

Point data is exposed as NumPy arrays. See zivid-python.

Color

Per-pixel color types in different channel orders, with and without alpha, in 8-bit and floating-point precision, and in linear and sRGB color spaces.

struct ColorRGBA : public Zivid::ColorRGBABase<uint8_t>

Color with 8-bit red, green, blue and alpha channels.

The order of the members is r, g, b, a, and each member is represented as an uint8_t. The members have values from 0 to 255. This type differs from ColorBGRA only in the order of the channels (RGBA vs. BGRA).

This format holds linear color values, which are suitable as input to computer vision algorithms. For showing colors on a display for viewing, consider using the ColorRGBA_SRGB format.

Public Functions

ColorRGBABase() = default

Constructor.

inline ColorRGBABase(T red, T green, T blue, T alpha)

Constructor.

struct ColorBGRA : public Zivid::ColorBGRABase<uint8_t>

Color with 8-bit blue, green, red and alpha channels.

The order of the members is b, g, r, a, and each member is represented as an uint8_t. The members have values from 0 to 255. This type differs from ColorRGBA only in the order of the channels (BGRA vs. RGBA).

This format holds linear color values, which are suitable as input to computer vision algorithms. For showing colors on a display for viewing, consider using the ColorRGBA_SRGB format.

Public Functions

ColorBGRABase() = default

Constructor.

inline ColorBGRABase(T blue, T green, T red, T alpha)

Constructor.

struct ColorRGB : public Zivid::ColorRGBBase<uint8_t>

Color with 8-bit red, green and blue channels (no alpha)

The order of the members is r, g, b and each member is represented as an uint8_t. The members have values from 0 to 255. This format is identical to ColorRGBA but skips the alpha channel for ~25% bandwidth savings on the device-side path.

This format holds linear color values, which are suitable as input to computer vision algorithms. For showing colors on a display for viewing, consider using the ColorRGB_SRGB format.

Public Functions

ColorRGBBase() = default

Constructor.

inline ColorRGBBase(T red, T green, T blue)

Constructor.

struct ColorBGR : public Zivid::ColorBGRBase<uint8_t>

Color with 8-bit blue, green and red channels (no alpha)

The order of the members is b, g, r and each member is represented as an uint8_t. The members have values from 0 to 255. This format is identical to ColorBGRA but skips the alpha channel for ~25% bandwidth savings on the device-side path.

This format holds linear color values, which are suitable as input to computer vision algorithms. For showing colors on a display for viewing, consider using the ColorBGR_SRGB format.

Public Functions

ColorBGRBase() = default

Constructor.

inline ColorBGRBase(T blue, T green, T red)

Constructor.

struct ColorRGBAf : public Zivid::ColorRGBABase<float>

Color with 32-bit red, green, blue and alpha channels.

The order of the members is r, g, b, a, and each member is represented as a 32-bit float. The members have values from 0 to 1.

Public Functions

ColorRGBABase() = default

Constructor.

inline ColorRGBABase(T red, T green, T blue, T alpha)

Constructor.

struct ColorSRGB : public Zivid::ColorRGBABase<uint8_t>

Color with 8-bit red, green, blue and alpha channels in the sRGB color space.

The order of the members is r, g, b, a and each member is represented as an uint8_t. The members have values from 0 to 255.

The sRGB color space is suitable for showing an image on a display for human viewing. It is easier to see details in darker areas of an image in sRGB than in linear RGB, as more of the dynamic range is dedicated to darker colors. This format is assumed by default by most monitors and should be used when displaying an image.

The name of this type is deprecated as of SDK 2.15. The type will be replaced in the next SDK major version (SDK 3.0). Prefer to use the new type name ColorRGBA_SRGB.

Public Functions

ColorRGBABase() = default

Constructor.

inline ColorRGBABase(T red, T green, T blue, T alpha)

Constructor.

typedef ColorSRGB Zivid::ColorRGBA_SRGB

Color with 8-bit red, green, blue and alpha channels in the sRGB color space.

The order of the members is r, g, b, a and each member is represented as an uint8_t. The members have values from 0 to 255.

The sRGB color space is suitable for showing an image on a display for human viewing. It is easier to see details in darker areas of an image in sRGB than in linear RGB, as more of the dynamic range is dedicated to darker colors. This format is assumed by default by most monitors and should be used when displaying an image.

struct ColorBGRA_SRGB : public Zivid::ColorBGRABase<uint8_t>

Color with 8-bit blue, green, red and alpha channels in the sRGB color space.

The order of the members is b, g, r, a and each member is represented as an uint8_t. The members have values from 0 to 255. This type differs from ColorRGBA_SRGB only in the order of the channels (BGRA vs. RGBA).

The sRGB color space is suitable for showing an image on a display for human viewing. It is easier to see details in darker areas of an image in sRGB than in linear RGB, as more of the dynamic range is dedicated to darker colors. This format is assumed by default by most monitors and should be used when displaying an image.

Public Functions

ColorBGRABase() = default

Constructor.

inline ColorBGRABase(T blue, T green, T red, T alpha)

Constructor.

struct ColorRGB_SRGB : public Zivid::ColorRGBBase<uint8_t>

Color with 8-bit red, green and blue channels (no alpha) in the sRGB color space.

The order of the members is r, g, b and each member is represented as an uint8_t. The members have values from 0 to 255. This format is identical to ColorRGBA_SRGB but skips the alpha channel for ~25% bandwidth savings on the device-side path.

The sRGB color space is suitable for showing an image on a display for human viewing.

Public Functions

ColorRGBBase() = default

Constructor.

inline ColorRGBBase(T red, T green, T blue)

Constructor.

struct ColorBGR_SRGB : public Zivid::ColorBGRBase<uint8_t>

Color with 8-bit blue, green and red channels (no alpha) in the sRGB color space.

The order of the members is b, g, r and each member is represented as an uint8_t. The members have values from 0 to 255. This format is identical to ColorBGRA_SRGB but skips the alpha channel for ~25% bandwidth savings on the device-side path.

The sRGB color space is suitable for showing an image on a display for human viewing.

Public Functions

ColorBGRBase() = default

Constructor.

inline ColorBGRBase(T blue, T green, T red)

Constructor.

struct ColorGray8 : public Zivid::ColorGrayBase<uint8_t>

Single-channel 8-bit grayscale intensity.

The single member is value, represented as an uint8_t with values from 0 to 255.

This format holds linear intensity, suitable as input to computer vision algorithms. On color sensors and stereo it is the average of the linear red, green and blue channels; on monochrome sensors it is produced directly from the sensor intensity.

Public Functions

ColorGrayBase() = default

Constructor.

inline ColorGrayBase(T grayValue)

Constructor.

struct ColorGray16 : public Zivid::ColorGrayBase<uint16_t>

Single-channel 16-bit grayscale intensity.

The single member is value, represented as an uint16_t with values from 0 to 65535.

This format holds linear intensity, suitable as input to computer vision algorithms. Compared to ColorGray8 it preserves more of the dynamic range. On color sensors and stereo it is the average of the linear red, green and blue channels; on monochrome sensors it is produced directly from the sensor intensity.

Public Functions

ColorGrayBase() = default

Constructor.

inline ColorGrayBase(T grayValue)

Constructor.

struct ColorRGBA

Color with 8-bit red, green, blue and alpha channels.

The order of the members is r, g, b, a, and each member is represented as an uint8_t. The members have values from 0 to 255. This type differs from ColorBGRA only in the order of the channels (RGBA vs. BGRA).

This format holds linear color values, which are suitable as input to computer vision algorithms. For showing colors on a display for viewing, consider using the ColorRGBA_SRGB format.

struct ColorBGRA

Color with 8-bit blue, green, red and alpha channels.

The order of the members is b, g, r, a, and each member is represented as an uint8_t. The members have values from 0 to 255. This type differs from ColorRGBA only in the order of the channels (BGRA vs. RGBA).

This format holds linear color values, which are suitable as input to computer vision algorithms. For showing colors on a display for viewing, consider using the ColorRGBA_SRGB format.

struct ColorRGBAf

Color with four float channels (red, green, blue, alpha)

Each channel is a 32-bit float in the range [0.0, 1.0]. This format holds linear color values, which are suitable as input to computer vision algorithms and GPU processing.

struct ColorSRGB

Color with 8-bit red, green, blue and alpha channels in the sRGB color space.

The sRGB color space is suitable for showing an image on a display for human viewing. It is easier to see details in darker areas of an image in sRGB than in linear RGB, as more of the dynamic range is dedicated to darker colors. This format is assumed by default by most monitors and should be used when displaying an image.

The order of the members is r, g, b, a, and each member is represented as an uint8_t. The members have values from 0 to 255. This type differs from ColorRGBA only in that it is intended to use with color values in the sRGB color space.

This type has been deprecated as of SDK 2.15. The type will be removed in the next SDK major version (SDK 3.0). Prefer to use the new equivalent type ColorRGBA_SRGB.

struct ColorRGBA_SRGB

Color with 8-bit red, green, blue and alpha channels in the sRGB color space.

The sRGB color space is suitable for showing an image on a display for human viewing. It is easier to see details in darker areas of an image in sRGB than in linear RGB, as more of the dynamic range is dedicated to darker colors. This format is assumed by default by most monitors and should be used when displaying an image.

The order of the members is r, g, b, a, and each member is represented as an uint8_t. The members have values from 0 to 255. This type differs from ColorRGBA only in that it is intended to use with color values in the sRGB color space.

struct ColorBGRA_SRGB

Color with 8-bit blue, green, red and alpha channels in the sRGB color space.

The sRGB color space is suitable for showing an image on a display for human viewing. It is easier to see details in darker areas of an image in sRGB than in linear RGB, as more of the dynamic range is dedicated to darker colors. This format is assumed by default by most monitors and should be used when displaying an image.

The order of the members is b, g, r, a, and each member is represented as an uint8_t. The members have values from 0 to 255. This type differs from ColorRGBA_SRGB only in the order of the channels (BGRA vs. RGBA).

Color data is exposed as NumPy arrays. See zivid-python.

Per-point composite

Combined point-and-color types plus per-point normals, signal-to-noise ratio and disparity.

struct PointXYZColorRGBA

Struct which contains XYZ point and RGBA color packed together.

Contains one PointXYZ (3*4 bytes) and one ColorRGBA (4*1 bytes), making this a 16 byte struct. This type differs from PointXYZColorBGRA only in the order of the color channels (RGBA vs. BGRA).

Public Functions

ZIVID_UTILS_EXPORT std::string toString () const

Get string representation.

ZIVID_UTILS_EXPORT bool operator== (const PointXYZColorRGBA &rhs) const

Check for equality.

ZIVID_UTILS_EXPORT bool operator!= (const PointXYZColorRGBA &rhs) const

Check for inequality.

Public Members

PointXYZ point

Point (contains x, y and z coordinates as floats)

ColorRGBA color

Color (RGBA order with 8 bits per channel)

struct PointXYZColorBGRA

Struct which contains XYZ point and BGRA color packed together.

Contains one PointXYZ (3*4 bytes) and one ColorBGRA (4*1 bytes), making this a 16 byte struct. This type differs from PointXYZColorRGBA only in the order of the color channels (BGRA vs. RGBA).

Public Functions

ZIVID_UTILS_EXPORT std::string toString () const

Get string representation.

ZIVID_UTILS_EXPORT bool operator== (const PointXYZColorBGRA &rhs) const

Check for equality.

ZIVID_UTILS_EXPORT bool operator!= (const PointXYZColorBGRA &rhs) const

Check for inequality.

Public Members

PointXYZ point

Point (contains x, y and z coordinates as floats)

ColorBGRA color

Color (BGRA order with 8 bits per channel)

struct NormalXYZ : public Zivid::VectorXYZ

Normal vector with three coordinates as float.

struct SNR

Signal-to-Noise ratio (SNR)

Public Types

using ValueType = float

The type of the SNR value.

Public Functions

ZIVID_UTILS_EXPORT std::string toString () const

Get the value as string.

ZIVID_UTILS_EXPORT bool operator== (const SNR &rhs) const

Check for equality.

ZIVID_UTILS_EXPORT bool operator!= (const SNR &rhs) const

Check for inequality.

Public Members

ValueType value

SNR value.

struct Disparity

Disparity value.

Public Types

using ValueType = float

The type of the disparity value.

Public Functions

ZIVID_UTILS_EXPORT std::string toString () const

Get the value as string.

ZIVID_UTILS_EXPORT bool operator== (const Disparity &rhs) const

Check for equality.

ZIVID_UTILS_EXPORT bool operator!= (const Disparity &rhs) const

Check for inequality.

Public Members

ValueType value

Disparity value.

struct PointXYZColorRGBA

Struct which contains XYZ point and RGBA color packed together.

Contains one PointXYZ (3*4 bytes) and one ColorRGBA (4*1 bytes), making this a 16 byte struct. This type differs from PointXYZColorBGRA only in the order of the color channels (RGBA vs. BGRA).

struct PointXYZColorBGRA

Struct which contains XYZ point and BGRA color packed together.

Contains one PointXYZ (3*4 bytes) and one ColorBGRA (4*1 bytes), making this a 16 byte struct. This type differs from PointXYZColorRGBA only in the order of the color channels (BGRA vs. RGBA).

struct NormalXYZ

Normal vector with three coordinates as float.

struct SNR

Signal-to-noise ratio value as float.

Composite point data is exposed as structured NumPy arrays. See zivid-python.

Containers

Generic 1D and 2D array containers used by the point cloud and image APIs.

template<typename DataFormat>
class Array1D

One-dimensional container of data.

Array1D manages the data using implicit sharing via reference counting. Copy or assignment of an Array1D object is shallow (only a pointer to the data is copied), which makes copy/assignment of Array1D fast. The data stored in the array is deallocated when there are no Array1D instances pointing to it.

The type of the elements stored in the array is given by template parameter DataFormat.

Public Types

using ValueType = DataFormat

The type of the elements stored in the Array.

using ConstIterator = const DataFormat*

The iterator type for immutable access.

It iterates over individual Array1D elements.

Public Functions

inline Array1D()

Create an empty Array1D.

inline size_t size() const

Get the number of elements in the array.

inline bool isEmpty() const

Check if the array is empty.

inline const DataFormat *data() const

Pointer to the first data element of the array.

If the array is empty then this method returns nullptr

inline const DataFormat &operator()(size_t idx) const

Constant reference to an element given by an index.

No bounds checking is performed. Calling this operator with an argument that is out of range causes undefined behavior. Calling this operator when the Array1D is empty causes undefined behavior.

Parameters:

idx – Index (from 0 to size - 1)

inline ConstIterator begin() const

Iterator to the beginning of the array.

inline ConstIterator end() const

Iterator to the end of the array.

inline ConstIterator cbegin() const

Iterator to the beginning of the array.

inline ConstIterator cend() const

Iterator to the end of the array.

inline std::string toString() const

Get array information as string.

template<typename DataFormat>
class Array2D

Two-dimensional container of data.

Array2D manages the data using implicit sharing via reference counting. Copy or assignment of an Array2D object is shallow (only a pointer to the data is copied), which makes copy/assignment of Array2D fast. The data stored in the array is deallocated when there are no Array2D instances pointing to it.

The type of the elements stored in the array is given by template parameter DataFormat. Elements are stored sequentially in row-major order. Use data to get a pointer to the first element (row 0, column 0).

Public Types

using ValueType = DataFormat

The type of the elements stored in the Array2D.

using ConstIterator = const DataFormat*

The iterator type for immutable access.

It iterates over individual Array2D elements in row major order.

Public Functions

inline Array2D()

Create an empty Array2D.

inline size_t width() const

Get the width of the array (number of columns)

inline size_t height() const

Get the height of the array (number of rows)

inline size_t size() const

Get the number of elements in the array.

This is identical to width() * height()

inline bool isEmpty() const

Check if the array is empty.

inline const DataFormat *data() const

Pointer to the first data element of the array.

If the array is empty then this method returns nullptr

inline const DataFormat &operator()(size_t idx) const

Constant reference to an element given by a 1D linear index.

Data is stored in row-major order. No bounds checking is performed. Calling this operator with an argument that is out of range causes undefined behavior. Calling this operator when the Array2D is empty causes undefined behavior.

Parameters:

idx – Index (from 0 to size - 1)

inline const DataFormat &operator()(size_t row, size_t column) const

Constant reference to an element given by row and column.

Data is stored in row-major order. No bounds checking is performed. Calling this operator with an argument that is out of range causes undefined behavior. Calling this operator when the Array2D is empty causes undefined behavior.

Parameters:
  • row – Row, from 0 to height - 1

  • column – Column, from 0 to width - 1

inline ConstIterator begin() const

Iterator to the beginning of the array.

inline ConstIterator end() const

Iterator to the end of the array.

inline ConstIterator cbegin() const

Iterator to the beginning of the array.

inline ConstIterator cend() const

Iterator to the end of the array.

inline std::string toString() const

Get array information as string.

The array containers are exposed through the C++ and Python APIs. See the Zivid API documentation for the full reference.

Array data is exposed as NumPy arrays. See zivid-python.

Masking

Binary mask applied to a point cloud or frame after capture, e.g. to keep only a region of interest. Used by the mask() / masked() methods on PointCloud and Frame.

class Mask : public Zivid::Array2D<uint8_t>

A mask for filtering point cloud data.

The Mask class represents a 2D binary mask that can be used to filter point cloud data. Zero values in the mask indicate that the corresponding point should be preserved, while non-zero values indicate that the point should be masked out (set to NaN).

Public Functions

ZIVID_UTILS_EXPORT Mask()

Create an empty mask.

explicit ZIVID_UTILS_EXPORT Mask(const Resolution &resolution)

Create a nonzero-filled mask with the specified resolution.

Parameters:

resolution – The resolution (width x height) of the mask

ZIVID_UTILS_EXPORT Mask(const Resolution &resolution, const uint8_t *beginIt, const uint8_t *endIt)

Create a mask from third-party mask data (e.g., OpenCV Mat)

The data is copied, so the original data can be safely freed after construction.

Parameters:
  • resolution – The resolution (width x height) of the mask

  • beginIt – Pointer to the beginning of mask data (uint8_t array)

  • endIt – Pointer to the end of mask data (uint8_t array)

template<typename Iterator, typename std::enable_if_t<std::is_convertible_v<typename std::iterator_traits<Iterator>::value_type, uint8_t>, std::nullptr_t> = nullptr>
inline Mask(const Resolution &resolution, Iterator beginIt, Iterator endIt)

Create a mask from iterator range.

Parameters:
  • resolution – The resolution (width x height) of the mask

  • beginIt – Iterator to the beginning of mask data

  • endIt – Iterator to the end of mask data

ZIVID_UTILS_EXPORT Resolution resolution () const

Get the resolution of the mask.

Returns:

Resolution object containing width and height of the mask

ZIVID_UTILS_EXPORT std::string toString () const

Get string representation of the mask.

inline ZIVID_UTILS_EXPORT uint8_t * data ()

Mutable pointer to the first data element of the mask.

If the mask is empty then this method returns nullptr

inline ZIVID_UTILS_EXPORT const uint8_t * data () const

Const pointer to the first data element of the mask.

If the mask is empty then this method returns nullptr

inline ZIVID_UTILS_EXPORT uint8_t * begin ()

Mutable iterator to the beginning of the mask.

Returns an iterator to the first element of the mask

inline ZIVID_UTILS_EXPORT uint8_t * end ()

Mutable iterator to the end of the mask.

Returns an iterator to one past the last element of the mask

inline ZIVID_UTILS_EXPORT uint8_t & operator() (size_t idx)

Mutable reference to an element given by a 1D linear index.

Data is stored in row-major order. No bounds checking is performed. Calling this operator with an argument that is out of range causes undefined behavior. Calling this operator when the mask is empty causes undefined behavior.

Parameters:

idx – Index (from 0 to size - 1)

inline ZIVID_UTILS_EXPORT uint8_t & operator() (size_t row, size_t column)

Mutable reference to an element given by row and column.

Data is stored in row-major order. No bounds checking is performed. Calling this operator with an argument that is out of range causes undefined behavior. Calling this operator when the mask is empty causes undefined behavior.

Parameters:
  • row – Row, from 0 to height - 1

  • column – Column, from 0 to width - 1

inline ZIVID_UTILS_EXPORT const uint8_t & operator() (size_t idx) const

Const reference to an element given by a 1D linear index.

Data is stored in row-major order. No bounds checking is performed. Calling this operator with an argument that is out of range causes undefined behavior. Calling this operator when the mask is empty causes undefined behavior.

Parameters:

idx – Index (from 0 to size - 1)

inline ZIVID_UTILS_EXPORT const uint8_t & operator() (size_t row, size_t column) const

Const reference to an element given by row and column.

Data is stored in row-major order. No bounds checking is performed. Calling this operator with an argument that is out of range causes undefined behavior. Calling this operator when the mask is empty causes undefined behavior.

Parameters:
  • row – Row, from 0 to height - 1

  • column – Column, from 0 to width - 1

class Mask

Binary mask for filtering point cloud data.

The Mask class represents a 2D binary mask that can be used to filter point cloud data. Zero values in the mask indicate that the corresponding point should be preserved, while non-zero values indicate that the point should be masked out (set to NaN).

Public Functions

Mask (Resolution ^ resolution)

Create an empty mask with specified resolution.

Parameters:

resolution – The resolution (width and height) of the mask

Mask (Resolution ^ resolution, cli::array< System::Byte > ^ data)

Create a mask from raw data.

Parameters:
  • resolution – The resolution (width and height) of the mask

  • data – Raw mask data as byte array

Resolution ^ GetResolution ()

Get the resolution of the mask.

System::String ^ ToString () override

Get a string representation of the mask.

Properties

size_t Width

Get the width of the mask.

size_t Height

Get the height of the mask.

System::Byte default [int, int]

Access mask element at given coordinates.

Param x:

X coordinate (column)

Param y:

Y coordinate (row)

See zivid.Mask in zivid-python.

Math and utility

A matrix type (used for transforms), a numeric range and a 2D resolution.

template<typename T, size_t rowCount, size_t colCount>
class Matrix

A fixed size matrix in row major order.

Public Types

using ValueType = T

The type stored in the matrix.

using Iterator = typename Storage::iterator

The matrix iterator type for mutable access.

It iterates over individual matrix elements in row major order.

using ConstIterator = typename Storage::const_iterator

The matrix iterator type for immutable access.

It iterates over individual matrix elements in row major order.

Public Functions

Matrix() = default

Constructor.

inline Matrix(const std::string &fileName)

Load the matrix from a file.

inline explicit Matrix(const std::array<T, colCount * rowCount> &arrArr)

Constructor.

template<typename U>
inline explicit Matrix(const Matrix<U, rowCount, colCount> &sourceMatrix)

Constructor.

template<typename Iterator>
inline Matrix(Iterator beginIt, Iterator endIt)

Constructor.

inline explicit Matrix(std::initializer_list<T> values)

Constructor.

inline explicit Matrix(std::initializer_list<std::initializer_list<T>> values)

Constructor.

inline Iterator begin()

Iterator to the beginning of the matrix.

inline Iterator end()

Iterator to the end of the matrix.

inline ConstIterator begin() const

Iterator to the beginning of the matrix.

inline ConstIterator end() const

Iterator to the end of the matrix.

inline ConstIterator cbegin() const

Iterator to the beginning of the matrix.

inline ConstIterator cend() const

Iterator to the end of the matrix.

inline T &at(size_t row, size_t col)

Access specified element with bounds checking.

inline const T &at(size_t row, size_t col) const

Access specified element with bounds checking.

inline T &operator()(size_t row, size_t col)

Access specified element without bounds checking.

inline const T &operator()(size_t row, size_t col) const

Access specified element without bounds checking.

inline T *data()

Pointer to the underlying data.

inline const T *data() const

Pointer to the underlying data.

void save(const std::string &fileName) const

Save the matrix to the given file.

The matrix is saved in YAML format.

void load(const std::string &fileName)

Load the matrix from the given file.

Loads the matrix into the object it was invoked on, does not return a value.

template<typename Q = T, typename = typename std::enable_if_t<invertSupported, Q>> ZIVID_UTILS_EXPORT Matrix inverse () const

Get the inverse of this matrix.

An exception is thrown if the matrix is not invertible.

Returns:

A new matrix, holding the inverse

inline std::string toString() const

Get string representation of the Matrix.

Returns:

Matrix as string

Public Static Functions

template<typename Q = T, typename = typename std::enable_if_t<identitySupported, Q>>
static inline Matrix identity()

Get the identity matrix of given type and size.

Returns:

An identity matrix of the given type and size

Public Static Attributes

static constexpr size_t rows = {rowCount}

The number of rows in the matrix.

static constexpr size_t cols = {colCount}

The number of columns in the matrix.

template<typename T>
class Range

Class describing a range of values for a given type T.

The range is inclusive, in other words both the minimum and maximum values are included in the range.

Public Types

using Type = T

Underlying type.

Public Functions

constexpr Range() = default

Default constructor.

inline constexpr Range(T min, T max)

Constructor.

inline constexpr const T &min() const

Get the minimum value of the range.

inline constexpr const T &max() const

Get the maximum value of the range.

inline constexpr bool isInRange(const T &value) const

Check if the value is in range.

The range is inclusive, in other words both the minimum and maximum values are included in the range.

inline bool operator==(const Range<T> &other) const

Comparison operator.

inline bool operator!=(const Range<T> &other) const

Comparison operator.

inline std::string toString() const

Get the range as string.

class Resolution

Class describing a resolution with a width and a height.

Public Functions

ZIVID_UTILS_EXPORT Resolution(size_t width, size_t height)

Construct a Resolution from width and height.

ZIVID_UTILS_EXPORT size_t width () const

Get the width value of the resolution.

ZIVID_UTILS_EXPORT size_t height () const

Get the height value of the resolution.

ZIVID_UTILS_EXPORT size_t size () const

Get the size (area) that is the product of the width and height.

ZIVID_UTILS_EXPORT bool operator== (const Resolution &other) const

Comparison operator.

ZIVID_UTILS_EXPORT bool operator!= (const Resolution &other) const

Comparison operator.

ZIVID_UTILS_EXPORT std::string toString () const

Get a string representation of the resolution.

template<typename T>
struct Range

Class describing a range of values for a given type T.

Public Functions

Range(T min, T max)

Constructor.

System::String ^ ToString () override

Get string representation of the object.

Properties

T Min

The minimum value.

T Max

The maximum value.

class Resolution

Class describing a resolution with a width and a height.

Public Functions

Resolution(size_t width, size_t height)

Construct a Resolution from width and height.

System::String ^ ToString () override

Get a string representation of the resolution.

Properties

size_t Size

Get the size (area) that is the product of the width and height.

size_t Width

Get the width value of the resolution.

size_t Height

Get the height value of the resolution.

Capture output and buffers

  • Image — the 2D image container (Applications Basic).

  • DeviceArray, DeviceArrayView, StreamOrQueue, ComputeDevice and the CUDA/OpenCL backend pointer types — GPU device buffers for zero-copy interop (Advanced: Data Access).

Camera intrinsics

  • CameraIntrinsics and Experimental::PixelMapping — camera matrix, distortion coefficients and sensor-to-projector pixel mapping (Camera Intrinsics).

Calibration results

  • Calibration::Pose, Calibration::DetectionResult, Calibration::DetectionResultFiducialMarkers, Calibration::MarkerShape and Calibration::MarkerDictionary — robot pose, calibration-board and marker detection (Hand-Eye Calibration).

  • Calibration::HandEyeInput, Calibration::HandEyeOutput and Calibration::HandEyeResidual — hand-eye calibration (Hand-Eye Calibration).

  • Calibration::MultiCameraOutput and Calibration::MultiCameraResidual — multi-camera calibration (Multi-Camera Calibration).

Detection results

  • Experimental::Toolbox::LinearBarcodeDetectionResult, Experimental::Toolbox::LinearBarcodeDecodingResult and Experimental::Toolbox::MatrixBarcodeDecodingResult — barcode detection (Barcode Detection).

  • Experimental::Toolbox::LocalPointCloudRegistrationResult — point cloud registration (Point Cloud Registration).

Info and maintenance

  • CameraInfo, CameraState, CameraHealth, SceneConditions and FrameInfo — camera metadata, telemetry, health and per-frame information (Camera Info and Maintenance).