|
array
C++ library for multi-dimensional arrays
|
Optional image-specific helpers and specializations. More...
#include "array/array.h"Go to the source code of this file.
Classes | |
| class | shape_traits< chunky_image_shape< Channels, XStride > > |
| class | shape_traits< chunky_image_shape< Channels > > |
Typedefs | |
| using | image_shape = shape< dim<>, dim<>, dim<>> |
| template<class T , class Alloc = std::allocator<T>> | |
| using | image = array< T, image_shape, Alloc > |
| template<class T > | |
| using | image_ref = array_ref< T, image_shape > |
| template<class T > | |
| using | const_image_ref = image_ref< const T > |
| template<index_t Channels = dynamic, index_t XStride = Channels> | |
| using | chunky_image_shape = shape< strided_dim< XStride >, dim<>, dense_dim< 0, Channels >> |
| template<class T , index_t Channels = dynamic, index_t XStride = Channels, class Alloc = std::allocator<T>> | |
| using | chunky_image = array< T, chunky_image_shape< Channels, XStride >, Alloc > |
| template<class T , index_t Channels = dynamic, index_t XStride = Channels> | |
| using | chunky_image_ref = array_ref< T, chunky_image_shape< Channels, XStride >> |
| template<class T , index_t Channels = dynamic, index_t XStride = Channels> | |
| using | const_chunky_image_ref = chunky_image_ref< const T, Channels, XStride > |
| using | planar_image_shape = shape< dense_dim<>, dim<>, dim<>> |
| template<class T , class Alloc = std::allocator<T>> | |
| using | planar_image = array< T, planar_image_shape, Alloc > |
| template<class T > | |
| using | planar_image_ref = array_ref< T, planar_image_shape > |
| template<class T > | |
| using | const_planar_image_ref = planar_image_ref< const T > |
Enumerations | |
| enum | crop_origin { zero, crop } |
Functions | |
| template<class Shape , class Fn > | |
| void | for_each_image_index (const Shape &s, Fn &&fn) |
| template<class Shape > | |
| Shape | crop_image_shape (Shape s, index_t x0, index_t y0, index_t x1, index_t y1, crop_origin origin=crop_origin::crop) |
| template<class T , class Shape > | |
| array_ref< T, Shape > | crop (const array_ref< T, Shape > &im, index_t x0, index_t y0, index_t x1, index_t y1, crop_origin origin=crop_origin::crop) |
| template<class T , class Shape > | |
| array_ref< const T, Shape > | crop (const array< T, Shape > &im, index_t x0, index_t y0, index_t x1, index_t y1, crop_origin origin=crop_origin::crop) |
| template<class T , class Shape > | |
| array_ref< T, Shape > | crop (array< T, Shape > &im, index_t x0, index_t y0, index_t x1, index_t y1, crop_origin origin=crop_origin::crop) |
| template<class T , class Shape > | |
| auto | slice_channel (const array_ref< T, Shape > &im, index_t channel) |
| template<class T , class Shape , class Alloc > | |
| auto | slice_channel (const array< T, Shape, Alloc > &im, index_t channel) |
| template<class T , class Shape , class Alloc > | |
| auto | slice_channel (array< T, Shape, Alloc > &im, index_t channel) |
Optional image-specific helpers and specializations.
| using image_shape = shape<dim<>, dim<>, dim<>> |
A generic image is any 3D array with dimensions x, y, c. c represents the channels of the image, typically it will have extent 3 or 4, with red, green, and blue mapped to indices in this dimension.
| using chunky_image_shape = shape<strided_dim<XStride>, dim<>, dense_dim<0, Channels>> |
A 'chunky' image is an array with 3 dimensions x, y, c, where c is dense, and the dimension with the next stride is x. The stride in x may be larger than the number of channels, to allow for padding pixels to a convenient alignment. This is a common image storage format used by many programs working with images.
| using planar_image_shape = shape<dense_dim<>, dim<>, dim<>> |
A 'planar' image is an array with dimensions x, y, c, where x is dense. This format is less common, but more convenient for optimization, particularly SIMD vectorization. Note that this shape also supports 'line-chunky' storage orders.
| void nda::for_each_image_index | ( | const Shape & | s, |
| Fn && | fn | ||
| ) |
Calls fn for each index in an image shape s. c is the innermost dimension of the loop nest.
| Shape nda::crop_image_shape | ( | Shape | s, |
| index_t | x0, | ||
| index_t | y0, | ||
| index_t | x1, | ||
| index_t | y1, | ||
| crop_origin | origin = crop_origin::crop |
||
| ) |
Crop an image shape s to the indices [x0, x1) x [y0, y1). The origin of the new shape is determined by origin.
| array_ref<T, Shape> nda::crop | ( | const array_ref< T, Shape > & | im, |
| index_t | x0, | ||
| index_t | y0, | ||
| index_t | x1, | ||
| index_t | y1, | ||
| crop_origin | origin = crop_origin::crop |
||
| ) |
Crop the im image or image ref to the interval [x0, x1) x [y0, y1). The result is a ref of the input image. The origin of the result is determined by origin.
1.8.11