libcvd
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
CVD::Internal::ImageData< T, false > Class Template Reference
Collaboration diagram for CVD::Internal::ImageData< T, false >:
Collaboration graph
[legend]

Public Types

typedef BasicImageIterator< T > iterator
 
typedef BasicImageIterator< const T > const_iterator
 
typedef T value_type
 The data type of the pixels in the image.
 

Public Member Functions

 ImageData (T *data, const ImageRef &size)
 Construct an image from a block of data, assuming tight packing. More...
 
 ImageData (T *data, const ImageRef &size, int stride)
 Construct an image from a block of data. More...
 
bool in_image (const ImageRef &ir) const
 Is this pixel co-ordinate inside the image? More...
 
bool in_image_with_border (const ImageRef &ir, int border) const
 Is this pixel co-ordinate inside the image, and not too close to the edges? More...
 
T & operator[] (const ImageRef &pos)
 Access a pixel from the image. More...
 
const T & operator[] (const ImageRef &pos) const
 Access a pixel from the image. More...
 
T * operator[] (int row)
 Access pointer to pixel row. More...
 
const T * operator[] (int row) const
 Access pointer to pixel row. More...
 
ImageRef pos (const T *ptr) const
 Given a pointer, this returns the image position as an ImageRef.
 
iterator begin ()
 Returns an iterator referencing the first (top-left) pixel in the image.
 
const_iterator begin () const
 Returns a const iterator referencing the first (top-left) pixel in the image.
 
iterator end ()
 Returns an iterator pointing to one past the end of the image.
 
const_iterator end () const
 Returns a const iterator pointing to one past the end of the image.
 
int row_stride () const
 What is the row stride of the image?
 
BasicImage< T > sub_image (const ImageRef &start, const ImageRef &size)
 Return a sub image. More...
 
const BasicImage< T > sub_image (const ImageRef &start, const ImageRef &size) const
 Return a sub image. More...
 
 ImageData (const ImageData &)=default
 
ImageDataoperator= (const ImageData &)=default
 

Protected Types

using PointerType = T *
 
using ConstPointerType = const T *
 

Protected Member Functions

T * end_ptr ()
 Return an off-the-end pointer without ever throwing AccessOutsideImage.
 
const T * end_ptr () const
 Return an off-the-end pointer without ever throwing AccessOutsideImage.
 

Protected Attributes

T * my_data
 
ImageRef my_size
 
int my_stride
 

Constructor & Destructor Documentation

◆ ImageData() [1/2]

template<class T >
CVD::Internal::ImageData< T, false >::ImageData ( T *  data,
const ImageRef size 
)
inline

Construct an image from a block of data, assuming tight packing.

Parameters
dataThe image data in horizontal scanline order
sizeThe size of the image

◆ ImageData() [2/2]

template<class T >
CVD::Internal::ImageData< T, false >::ImageData ( T *  data,
const ImageRef size,
int  stride 
)
inline

Construct an image from a block of data.

Parameters
dataThe image data in horizontal scanline order
sizeThe size of the image
strideThe row stride (or width, including the padding)

Member Function Documentation

◆ in_image()

template<class T >
bool CVD::Internal::ImageData< T, false >::in_image ( const ImageRef ir) const
inline

Is this pixel co-ordinate inside the image?

Parameters
irThe co-ordinate to test

◆ in_image_with_border()

template<class T >
bool CVD::Internal::ImageData< T, false >::in_image_with_border ( const ImageRef ir,
int  border 
) const
inline

Is this pixel co-ordinate inside the image, and not too close to the edges?

Parameters
irThe co-ordinate to test
borderThe size of the border: positive points inside the image.

◆ operator[]() [1/4]

template<class T >
T& CVD::Internal::ImageData< T, false >::operator[] ( const ImageRef pos)
inline

Access a pixel from the image.

Bounds checking is only performed if the library is compiled with -D CVD_IMAGE_DEBUG, in which case an ImageError::AccessOutsideImage exception is thrown.

◆ operator[]() [2/4]

template<class T >
const T& CVD::Internal::ImageData< T, false >::operator[] ( const ImageRef pos) const
inline

Access a pixel from the image.

Bounds checking is only performed if the library is compiled with -D CVD_IMAGE_DEBUG, in which case an ImageError::AccessOutsideImage exception is thrown.

◆ operator[]() [3/4]

template<class T >
T* CVD::Internal::ImageData< T, false >::operator[] ( int  row)
inline

Access pointer to pixel row.

Returns the pointer to the first element of the passed row. Allows to use [y][x] on images to access a pixel. Bounds checking is only performed if the library is compiled with -D CVD_IMAGE_DEBUG, in which case an ImageError::AccessOutsideImage exception is thrown.

◆ operator[]() [4/4]

template<class T >
const T* CVD::Internal::ImageData< T, false >::operator[] ( int  row) const
inline

Access pointer to pixel row.

Returns the pointer to the first element of the passed row. Allows to use [y][x] on images to access a pixel. Bounds checking is only performed if the library is compiled with -D CVD_IMAGE_DEBUG, in which case an ImageError::AccessOutsideImage exception is thrown.

◆ sub_image() [1/2]

template<class T >
BasicImage<T> CVD::Internal::ImageData< T, false >::sub_image ( const ImageRef start,
const ImageRef size 
)

Return a sub image.

Parameters
startTop left pixel of the sub image
sizewidth and height of the sub image

◆ sub_image() [2/2]

template<class T >
const BasicImage<T> CVD::Internal::ImageData< T, false >::sub_image ( const ImageRef start,
const ImageRef size 
) const

Return a sub image.

Parameters
startTop left pixel of the sub image
sizewidth and height of the sub image

The documentation for this class was generated from the following file: