|
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 (std::uint32_t cols, std::uint32_t rows, std::uint32_t nchannel, ifm3d::PixelFormat format, const std::optional< ifm3d::json > &metadata=std::nullopt, ifm3d::buffer_id buffer_id=static_cast< ifm3d::buffer_id >(0)) | |
| Buffer (Buffer &&)=default | |
| Buffer & | operator= (Buffer &&)=default |
| Buffer (const Buffer &)=default | |
| Buffer & | operator= (const Buffer &)=default |
| void | Create (std::uint32_t cols, std::uint32_t rows, std::uint32_t nchannel, ifm3d::PixelFormat format, ifm3d::buffer_id buffer_id) |
| 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 | NumChannels () const |
| ifm3d::PixelFormat | DataFormat () const |
| ifm3d::json | Metadata () const |
| ifm3d::buffer_id | BufferId () const |
| size_t | Size () const |
| Return the size of the buffer in bytes. | |
| template<typename T = std::uint8_t> | |
| T * | Ptr (std::uint32_t row) |
| returns a pointer to the specified Buffer row. More... | |
| template<typename T = std::uint8_t> | |
| T const * | Ptr (std::uint32_t row) const |
| returns a pointer to the specified Buffer row. More... | |
| template<typename T = std::uint8_t> | |
| T * | Ptr (std::uint32_t row, std::uint32_t col) |
| Pointer to the Pixel at row,col. More... | |
| template<typename T = std::uint8_t> | |
| T const * | Ptr (std::uint32_t row, std::uint32_t col) const |
| Pointer to the Pixel at row,col. More... | |
| template<typename T > | |
| T & | At (std::size_t index) |
| template<typename T > | |
| T & | At (std::uint32_t row, std::uint32_t col) |
| template<typename T > | |
| T const & | At (std::size_t index) const |
| template<typename T > | |
| T const & | At (std::uint32_t row, std::uint32_t col) const |
| template<typename T > | |
| void | SetTo (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 | ( | std::uint32_t | row | ) |
returns a pointer to the specified Buffer row.
| row | number |
| T const* ifm3d::Buffer::Ptr | ( | std::uint32_t | row | ) | const |
returns a pointer to the specified Buffer row.
| row | number |
| T* ifm3d::Buffer::Ptr | ( | std::uint32_t | row, |
| std::uint32_t | col | ||
| ) |
Pointer to the Pixel at row,col.
| row | 1st dimension index |
| col | 2nd dimension index |
| T const* ifm3d::Buffer::Ptr | ( | std::uint32_t | row, |
| std::uint32_t | col | ||
| ) | const |
Pointer to the Pixel at row,col.
| row | 1st dimension index |
| col | 2nd dimension index |