Zivid C++ API 2.18.0+1b44dbef-1
Zivid::Mask Class Reference

A mask for filtering point cloud data. More...

#include <Zivid/Mask.h>

Inheritance diagram for Zivid::Mask:
Zivid::Array2D< uint8_t >

Public Member Functions

ZIVID_UTILS_EXPORT Mask ()
 Create an empty mask.
ZIVID_UTILS_EXPORT Mask (const Resolution &resolution)
 Create a nonzero-filled mask with the specified resolution.
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)
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>
 Mask (const Resolution &resolution, Iterator beginIt, Iterator endIt)
 Create a mask from iterator range.
ZIVID_UTILS_EXPORT Resolution resolution () const
 Get the resolution of the mask.
ZIVID_UTILS_EXPORT std::string toString () const
 Get string representation of the mask.
ZIVID_UTILS_EXPORT uint8_t * data ()
 Mutable pointer to the first data element of the mask.
ZIVID_UTILS_EXPORT const uint8_t * data () const
 Const pointer to the first data element of the mask.
ZIVID_UTILS_EXPORT uint8_t * begin ()
 Mutable iterator to the beginning of the mask.
ZIVID_UTILS_EXPORT uint8_t * end ()
 Mutable iterator to the end of the mask.
ZIVID_UTILS_EXPORT uint8_t & operator() (size_t idx)
 Mutable reference to an element given by a 1D linear index.
ZIVID_UTILS_EXPORT uint8_t & operator() (size_t i, size_t j)
 Mutable reference to an element given by row and column.
ZIVID_UTILS_EXPORT const uint8_t & operator() (size_t idx) const
 Const reference to an element given by a 1D linear index.
ZIVID_UTILS_EXPORT const uint8_t & operator() (size_t i, size_t j) const
 Const reference to an element given by row and column.
Public Member Functions inherited from Zivid::Array2D< uint8_t >
 Array2D ()
 Create an empty Array2D.
size_t width () const
 Get the width of the array (number of columns)
size_t height () const
 Get the height of the array (number of rows)
size_t size () const
 Get the number of elements in the array.
bool isEmpty () const
 Check if the array is empty.
const uint8_t * data () const
 Pointer to the first data element of the array.
const uint8_t & operator() (size_t idx) const
 Constant reference to an element given by a 1D linear index.
ConstIterator begin () const
 Iterator to the beginning of the array.
ConstIterator end () const
 Iterator to the end of the array.
ConstIterator cbegin () const
 Iterator to the beginning of the array.
ConstIterator cend () const
 Iterator to the end of the array.
std::string toString () const
 Get array information as string.

Additional Inherited Members

Public Types inherited from Zivid::Array2D< uint8_t >
using ValueType
 The type of the elements stored in the Array2D.
using ConstIterator
 The iterator type for immutable access. It iterates over individual Array2D elements in row major order.

Detailed Description

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).

Constructor & Destructor Documentation

◆ Mask() [1/4]

ZIVID_UTILS_EXPORT Zivid::Mask::Mask ( )

Create an empty mask.

◆ Mask() [2/4]

ZIVID_UTILS_EXPORT Zivid::Mask::Mask ( const Resolution & resolution)
explicit

Create a nonzero-filled mask with the specified resolution.

Parameters
resolutionThe resolution (width x height) of the mask

◆ Mask() [3/4]

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

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

Parameters
resolutionThe resolution (width x height) of the mask
beginItPointer to the beginning of mask data (uint8_t array)
endItPointer to the end of mask data (uint8_t array)

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

◆ Mask() [4/4]

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>
Zivid::Mask::Mask ( const Resolution & resolution,
Iterator beginIt,
Iterator endIt )
inline

Create a mask from iterator range.

Parameters
resolutionThe resolution (width x height) of the mask
beginItIterator to the beginning of mask data
endItIterator to the end of mask data

Member Function Documentation

◆ begin()

ZIVID_UTILS_EXPORT uint8_t * Zivid::Mask::begin ( )
inline

Mutable iterator to the beginning of the mask.

Returns an iterator to the first element of the mask

◆ data() [1/2]

ZIVID_UTILS_EXPORT uint8_t * Zivid::Mask::data ( )
inline

Mutable pointer to the first data element of the mask.

If the mask is empty then this method returns nullptr

◆ data() [2/2]

ZIVID_UTILS_EXPORT const uint8_t * Zivid::Mask::data ( ) const
inline

Const pointer to the first data element of the mask.

If the mask is empty then this method returns nullptr

◆ end()

ZIVID_UTILS_EXPORT uint8_t * Zivid::Mask::end ( )
inline

Mutable iterator to the end of the mask.

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

◆ operator()() [1/4]

ZIVID_UTILS_EXPORT uint8_t & Zivid::Mask::operator() ( size_t i,
size_t j )
inline

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
iRow, from 0 to height - 1
jColumn, from 0 to width - 1

◆ operator()() [2/4]

ZIVID_UTILS_EXPORT const uint8_t & Zivid::Mask::operator() ( size_t i,
size_t j ) const
inline

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
iRow, from 0 to height - 1
jColumn, from 0 to width - 1

◆ operator()() [3/4]

ZIVID_UTILS_EXPORT uint8_t & Zivid::Mask::operator() ( size_t idx)
inline

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
idxIndex (from 0 to size - 1)

◆ operator()() [4/4]

ZIVID_UTILS_EXPORT const uint8_t & Zivid::Mask::operator() ( size_t idx) const
inline

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
idxIndex (from 0 to size - 1)

◆ resolution()

ZIVID_UTILS_EXPORT Resolution Zivid::Mask::resolution ( ) const

Get the resolution of the mask.

Returns
Resolution object containing width and height of the mask

◆ toString()

ZIVID_UTILS_EXPORT std::string Zivid::Mask::toString ( ) const

Get string representation of the mask.


The documentation for this class was generated from the following file: