N-dimensional container. More...
Modules | |
Concepts | |
Image concepts. | |
Models | |
Image models. | |
N-dimensional container.
An image is a container of N-dimensional data. GIL provides only one model, a two dimensional image whose value_type
is a pixel.
Images are regular types (which means they have a default constructor, a copy constructor, operator=
, operator==
, operator!=
, and swap
) As containers, images own the data, which means they allocate the data in their constructors and deallocate in the destructors. Their copy construction, assignment and equality comparison is deep (i.e. propagates the operation to the values). That makes images expensive to pass by value, unlike views.
Also, unlike views, images propagate their constness to the data. An const-qualified image does not allow for modifying its pixels and does not provide a mutable view over its pixels.
Images provide two services: they manage ownership of their data (the pixels) and they can return a view over their pixels. Algorithms predominantly operate on views. This is analogous to the STL: In the STL containers (like std::vector
) provide ranges (vec.begin()
and vec.end()
) and algorithms typically operate on ranges. The GIL equivalent of a range is an image view.