|
| Image ()=default |
| Create an empty image More...
|
|
template<typename Iterator > |
| Image (const Resolution &resolution, Iterator beginIt, Iterator endIt) |
| Create an image from a buffer of elements by copy More...
|
|
| Image (const Resolution &resolution, const unsigned char *begin, const unsigned char *end) |
| Create an image from an unsigned char byte buffer More...
|
|
void | save (const std::string &fileName) const |
| Save the image to a file. The supported file types are PNG (.png), JPEG (.jpg, .jpeg) and BMP (.bmp). This method will throw an exception if failing to save to the provided fileName. More...
|
|
| Array2D () |
| Create an empty Array2D More...
|
|
size_t | width () const |
| Get the width of the array (number of columns) More...
|
|
size_t | height () const |
| Get the height of the array (number of rows) More...
|
|
size_t | size () const |
| Get the number of elements in the array More...
|
|
bool | isEmpty () const |
| Check if the array is empty More...
|
|
const PixelFormat * | data () const |
| Pointer to the first data element of the array More...
|
|
const PixelFormat & | operator() (size_t idx) const |
| Constant reference to an element given by a 1D linear index More...
|
|
const PixelFormat & | operator() (size_t i, size_t j) const |
| Constant reference to an element given by row and column More...
|
|
ConstIterator | begin () const |
| Iterator to the beginning of the array More...
|
|
ConstIterator | end () const |
| Iterator to the end of the array More...
|
|
ConstIterator | cbegin () const |
| Iterator to the beginning of the array More...
|
|
ConstIterator | cend () const |
| Iterator to the end of the array More...
|
|
std::string | toString () const |
| Get array information as string More...
|
|
template<class PixelFormat>
class Zivid::Image< PixelFormat >
A 2-dimensional image
The type of each pixel in the image is given by template parameter PixelFormat
. Currently the only supported PixelFormat
s are ColorRGBA and ColorBGRA.
template<class PixelFormat >
Zivid::Image< PixelFormat >::Image |
( |
const Resolution & |
resolution, |
|
|
const unsigned char * |
begin, |
|
|
const unsigned char * |
end |
|
) |
| |
|
inline |
Create an image from an unsigned char
byte buffer
Copies the buffer without taking ownership. The byte size of the buffer (i.e., end - begin
) must be equal to the byte size of the image (i.e., resolution.size() * sizeof(PixelFormat)
). Otherwise, an exception will be thrown. The layout of the buffer must match the memory layout of PixelFormat
, and the elements must be stored in row-major order; the input buffer will be copied as-is.
- Parameters
-
resolution | The resolution of the image (i.e., width and height) |
begin | A pointer to the first element in the buffer |
end | A pointer to the element following the last element in the buffer. See https://en.cppreference.com/w/cpp/iterator/end. |