ifm3d
|
The class Buffer represent a STL container to store data from the ifm devices in 2 dimension and supports multiple channel. More...
#include <ifm3d/fg/buffer.h>
Classes | |
struct | Iterator |
Public Member Functions | |
Buffer () | |
These are various constructors that form a Buffer. More... | |
Buffer (const std::uint32_t cols, const std::uint32_t rows, const std::uint32_t nchannel, ifm3d::pixel_format format, std::optional< ifm3d::json > metadata=std::nullopt) | |
Buffer (Buffer &&)=default | |
Buffer & | operator= (Buffer &&)=default |
Buffer (const Buffer &)=default | |
Buffer & | operator= (const Buffer &)=default |
void | create (const std::uint32_t cols, const std::uint32_t rows, const std::uint32_t nchannel, ifm3d::pixel_format format) |
Buffer | clone () const |
Creates a full copy of the array and the underlying data. | |
std::uint32_t | height () const |
std::uint32_t | width () const |
std::uint32_t | nchannels () const |
ifm3d::pixel_format | dataFormat () const |
ifm3d::json | metadata () const |
size_t | size () const |
Return the size of the buffer in bytes. | |
template<typename T = std::uint8_t> | |
T * | ptr (const std::uint32_t row) |
returns a pointer to the specified Buffer row. More... | |
template<typename T = std::uint8_t> | |
T const * | ptr (const std::uint32_t row) const |
returns a pointer to the specified Buffer row. More... | |
template<typename T = std::uint8_t> | |
T * | ptr (const std::uint32_t row, const std::uint32_t col) |
Pointer to the Pixel at row,col. More... | |
template<typename T = std::uint8_t> | |
T const * | ptr (const std::uint32_t row, const std::uint32_t col) const |
Pointer to the Pixel at row,col. More... | |
template<typename T > | |
T & | at (const std::size_t index) |
template<typename T > | |
T & | at (const std::uint32_t row, const std::uint32_t col) |
template<typename T > | |
T const & | at (const std::size_t index) const |
template<typename T > | |
T const & | at (const std::uint32_t row, const std::uint32_t col) const |
template<typename T > | |
void | setTo (const T val, const ifm3d::Buffer &mask) |
template<typename T > | |
Iterator< T > | begin () |
template<typename T > | |
Iterator< T > | end () |
The class Buffer represent a STL container to store data from the ifm devices in 2 dimension and supports multiple channel.
Data stored in sequential memory layout and class provides function template to access the pixel. Creating an Buffer object :
For example, FORMAT_8U means a 8-bit array, FORMAT_32F floating-point array, and so on.
note: create() allocates new memory.
to access a pixel in Buffer I ( 100,100,1,ifm3d::FORMAT_8U) at 50,50 position
changing the pixel value can be done as follow : writing 100 at pixel postion 50,50
to access a pixel in n-channel Buffer I ( 100,100,3,ifm3d::FORMAT_8U) at 50,50 position This will be the case accessing the values for 3 channel Buffer as pixel is structure of the values of n-chanel at given position.
One can also use range based for loops with adapter explained in ifm3d::IteratorAdapter section
ifm3d::Buffer::Buffer | ( | ) |
T* ifm3d::Buffer::ptr | ( | const std::uint32_t | row | ) |
returns a pointer to the specified Buffer row.
row | number |
T const* ifm3d::Buffer::ptr | ( | const std::uint32_t | row | ) | const |
returns a pointer to the specified Buffer row.
row | number |
T* ifm3d::Buffer::ptr | ( | const std::uint32_t | row, |
const std::uint32_t | col | ||
) |
Pointer to the Pixel at row,col.
row | 1st dimension index |
col | 2nd dimension index |
T const* ifm3d::Buffer::ptr | ( | const std::uint32_t | row, |
const std::uint32_t | col | ||
) | const |
Pointer to the Pixel at row,col.
row | 1st dimension index |
col | 2nd dimension index |