#include <VectorComponentAccessor.hpp>
Public Types | |
typedef vector_image_t::data_t::data_t | data_t |
Public Member Functions | |
VectorComponentAccessor (vector_image_t &image, size_t component) | |
data_t | operator[] (const ublas::fixed_vector< size_t, dimension > &index) const |
data_reference | operator[] (const ublas::fixed_vector< size_t, dimension > &index) |
Static Public Attributes | |
static const size_t | dimension |
Use this class to access components of vector valued pixels in images. By vector valued we mean that the pixel data type of the input image data consists of different components (all of the same type) which can be accessed by operator(). The following code example copies the green component of colour_image to green_channel. It then processes the green_channel and assigns the possibly modified channel back to the original image:
ColorImage2d colour_image("some_image.png"); GrayImage2d green_channel(colour_image.size()); VectorComponentAccessor<ColorImage2d> accessor(colour_image, 2); green_channel = accessor; // process green_channel... accessor = green_channel;
typedef vector_image_t::data_t::data_t imaging::VectorComponentAccessor< vector_image_t >::data_t |
The data type which is stored in the image. Common choices are float_t for grayscale images stored at floating point precision or char for 8-bit data.
Reimplemented from imaging::ImageAccessorInterface< vector_image_t, vector_image_t::data_t::data_t >.
imaging::VectorComponentAccessor< vector_image_t >::VectorComponentAccessor | ( | vector_image_t & | image, | |
size_t | component | |||
) | [inline] |
Initialize the image accessor with an reference to image which must be an ImageInterface object with vector valued pixel data. The accessor will then behave as a scalar valued image consisting of the values of the component-th channel of image. The reference will be stored and accessed when the image accessor is utilized. The dimensions of the accessor are the same as those of image.
Note that component must be within the range of the components of the pixel data of image. E.g. component must not exceed 2 in case of RGB images.
data_t imaging::VectorComponentAccessor< vector_image_t >::operator[] | ( | const ublas::fixed_vector< size_t, dimension > & | index | ) | const [inline] |
Returns a constant reference to a pixel.
Reimplemented from imaging::ImageInterface< vector_image_t::dimension, vector_image_t::data_t::data_t >.
data_reference imaging::VectorComponentAccessor< vector_image_t >::operator[] | ( | const ublas::fixed_vector< size_t, dimension > & | index | ) | [inline] |
Returns a reference to a pixel. This function might not be implemented for accessor classes to constant data, such as ConstImageAccessorInterface().
Reimplemented from imaging::ImageInterface< vector_image_t::dimension, vector_image_t::data_t::data_t >.
const size_t imaging::VectorComponentAccessor< vector_image_t >::dimension [static] |
Initial value:
ImageAccessorInterface<vector_image_t, data_t>::dimension
Reimplemented from imaging::ImageAccessorInterface< vector_image_t, vector_image_t::data_t::data_t >.