Back to Arangodb

Image

3rdParty/boost/1.78.0/libs/gil/doc/html/design/image.html

3.12.9.13.3 KB
Original Source

Image

Overview

An image is a container that owns the pixels of a given image view It allocates them in its constructor and deletes them in the destructor. It has a deep assignment operator and copy constructor. Images are used rarely, just when data ownership is important. Most STL algorithms operate on ranges, not containers. Similarly most GIL algorithms operate on image views (which images provide).

In the most general form images are N-dimensional and satisfy the following concept:

conceptRandomAccessNDImageConcept\<typenameImg\>:Regular\{typenameview\_t;whereMutableRandomAccessNDImageViewConcept\<view\_t\>;typenameconst\_view\_t=view\_t::const\_t;typenamepoint\_t=view\_t::point\_t;typenamevalue\_type=view\_t::value\_type;typenameallocator\_type;Img::Img(point\_tdims,std::size\_talignment=0);Img::Img(point\_tdims,value\_typefill\_value,std::size\_talignment);voidImg::recreate(point\_tnew\_dims,std::size\_talignment=0);voidImg::recreate(point\_tnew\_dims,value\_typefill\_value,std::size\_talignment);constpoint\_t&Img::dimensions()const;constconst\_view\_t&const\_view(constImg&);constview\_t&view(Img&);};

Two-dimensional images have additional requirements:

conceptRandomAccess2DImageConcept\<RandomAccessNDImageConceptImg\>{typenamex\_coord\_t=const\_view\_t::x\_coord\_t;typenamey\_coord\_t=const\_view\_t::y\_coord\_t;Img::Img(x\_coord\_twidth,y\_coord\_theight,std::size\_talignment=0);Img::Img(x\_coord\_twidth,y\_coord\_theight,value\_typefill\_value,std::size\_talignment);x\_coord\_tImg::width()const;y\_coord\_tImg::height()const;voidImg::recreate(x\_coord\_twidth,y\_coord\_theight,std::size\_talignment=1);voidImg::recreate(x\_coord\_twidth,y\_coord\_theight,value\_typefill\_value,std::size\_talignment);};

GIL images have views that model ImageViewConcept and operate on pixels.

conceptImageConcept\<RandomAccess2DImageConceptImg\>{whereMutableImageViewConcept\<view\_t\>;typenamecoord\_t=view\_t::coord\_t;};

Images, unlike locators and image views, don’t have ‘mutable’ set of concepts because immutable images are not very useful.

See also

Models

GIL provides a class, image, which is templated over the value type (the pixel) and models ImageConcept:

template\<typenamePixel,// Models PixelValueConceptboolIsPlanar,// planar or interleaved imagetypenameA=std::allocator\<unsignedchar\>\>classimage;

The image constructor takes an alignment parameter which allows for constructing images that are word-aligned or 8-byte aligned. The alignment is specified in bytes. The default value for alignment is 0, which means there is no padding at the end of rows. Many operations are faster using such 1D-traversable images, because image_view::x_iterator can be used to traverse the pixels, instead of the more complicated image_view::iterator. Note that when alignment is 0, packed images are aligned to the bit - i.e. there are no padding bits at the end of rows of packed images.