CVD::SubImage< T > Class Template Reference
[Image storage and manipulation]

#include <image.h>

Inheritance diagram for CVD::SubImage< T >:
Inheritance graph
[legend]

List of all members.

Public Types

typedef ConstSubImageIterator< T > const_iterator
typedef SubImageIterator< T > iterator

Public Member Functions

const_iterator begin () const
 Returns a const iterator referencing the first (top-left) pixel in the image.
iterator begin ()
 Returns an iterator referencing the first (top-left) pixel in the image.
void copy_from (const SubImage< T > &other)
T * data ()
 Returns the raw image data.
const T * data () const
 Returns the raw image data.
const_iterator end () const
 Returns a const iterator pointing to one past the end of the image.
iterator end ()
 Returns an iterator pointing to one past the end of the image.
void fill (const T d)
bool in_image (const ImageRef &ir) const
bool in_image_with_border (const ImageRef &ir, int border) const
const T * operator[] (int row) const
T * operator[] (int row)
const T & operator[] (const ImageRef &pos) const
T & operator[] (const ImageRef &pos)
ImageRef pos (const T *ptr) const
 Given a pointer, this returns the image position as an ImageRef.
SubImageref ()
 Return a reference to a SubImage. Useful for passing anonymous SubImages to functions.
int row_stride () const
 What is the row stride of the image?
ImageRef size () const
 What is the size of this image?
const SubImage sub_image (const ImageRef &start, const ImageRef &size) const
SubImage sub_image (const ImageRef &start, const ImageRef &size)
 SubImage (const SubImage &copyof)
 SubImage (T *data, const ImageRef &size, int stride)
int totalsize () const
 What is the total number of elements in the image (i.e. size().x * size().y), including padding.
void zero ()
 Set all the pixels in the image to zero. This is a relatively fast operation, using memset.
 ~SubImage ()
 The image data is not destroyed when a BasicImage is destroyed.

Protected Member Functions

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

Protected Attributes

T * my_data
 The raw image data.
ImageRef my_size
 The size of the image.
int my_stride
 The row stride.

Detailed Description

template<class T>
class CVD::SubImage< T >

A generic image class to manage a block of arbitrarily padded data as an image. Provides basic image access such as accessing a particular pixel co-ordinate.

Parameters:
T The pixel type for this image. Typically either CVD::byte or CVD::Rgb<CVD::byte> > are used, but images could be constructed of any available type.

A BasicImage does not manage its own data, but provides access to an arbitrary externally-managed block of data as though it were an image. Use the derived Image class if you want an image which also has its own data.

Definition at line 252 of file image.h.


Member Typedef Documentation

template<class T>
typedef ConstSubImageIterator<T> CVD::SubImage< T >::const_iterator
template<class T>
typedef SubImageIterator<T> CVD::SubImage< T >::iterator

Constructor & Destructor Documentation

template<class T>
CVD::SubImage< T >::SubImage ( T *  data,
const ImageRef size,
int  stride 
) [inline]

Construct an image from a block of data.

Parameters:
data The image data in horizontal scanline order
size The size of the image
stride The row stride (or width, including the padding)

Definition at line 259 of file image.h.

template<class T>
CVD::SubImage< T >::~SubImage (  )  [inline]

The image data is not destroyed when a BasicImage is destroyed.

Definition at line 281 of file image.h.

template<class T>
CVD::SubImage< T >::SubImage ( const SubImage< T > &  copyof  )  [inline]

Copy constructor

Parameters:
copyof The image to copy

Definition at line 407 of file image.h.

template<class T>
CVD::SubImage< T >::SubImage (  )  [inline, protected]

Definition at line 454 of file image.h.


Member Function Documentation

template<class T>
const_iterator CVD::SubImage< T >::begin (  )  const [inline]

Returns a const iterator referencing the first (top-left) pixel in the image.

Reimplemented in CVD::BasicImage< T >, CVD::BasicImage< C >, CVD::BasicImage< CVD::Rgb< byte > >, CVD::BasicImage< byte >, CVD::BasicImage< CVD::byte >, and CVD::BasicImage< Rgb8 >.

Definition at line 350 of file image.h.

template<class T>
iterator CVD::SubImage< T >::begin (  )  [inline]

Returns an iterator referencing the first (top-left) pixel in the image.

Reimplemented in CVD::BasicImage< T >, CVD::BasicImage< C >, CVD::BasicImage< CVD::Rgb< byte > >, CVD::BasicImage< byte >, CVD::BasicImage< CVD::byte >, and CVD::BasicImage< Rgb8 >.

Definition at line 345 of file image.h.

template<class T>
void CVD::SubImage< T >::copy_from ( const SubImage< T > &  other  )  [inline]

Reimplemented in CVD::Image< T >, CVD::Image< CVD::Rgb< byte > >, and CVD::Image< CVD::byte >.

Definition at line 368 of file image.h.

template<class T>
T* CVD::SubImage< T >::data (  )  [inline]

Returns the raw image data.

Definition at line 336 of file image.h.

template<class T>
const T* CVD::SubImage< T >::data (  )  const [inline]

Returns the raw image data.

Definition at line 330 of file image.h.

template<class T>
const_iterator CVD::SubImage< T >::end (  )  const [inline]

Returns a const iterator pointing to one past the end of the image.

Reimplemented in CVD::BasicImage< T >, CVD::BasicImage< C >, CVD::BasicImage< CVD::Rgb< byte > >, CVD::BasicImage< byte >, CVD::BasicImage< CVD::byte >, and CVD::BasicImage< Rgb8 >.

Definition at line 362 of file image.h.

template<class T>
iterator CVD::SubImage< T >::end (  )  [inline]

Returns an iterator pointing to one past the end of the image.

Reimplemented in CVD::BasicImage< T >, CVD::BasicImage< C >, CVD::BasicImage< CVD::Rgb< byte > >, CVD::BasicImage< byte >, CVD::BasicImage< CVD::byte >, and CVD::BasicImage< Rgb8 >.

Definition at line 356 of file image.h.

template<class T>
const T* CVD::SubImage< T >::end_ptr (  )  const [inline, protected]

Return an off-the-end pointer without ever throwing AccessOutsideImage.

Definition at line 452 of file image.h.

template<class T>
T* CVD::SubImage< T >::end_ptr (  )  [inline, protected]

Return an off-the-end pointer without ever throwing AccessOutsideImage.

Definition at line 449 of file image.h.

template<class T>
void CVD::SubImage< T >::fill ( const T  d  )  [inline]

Set all the pixels in the image to a value. This is a relatively fast operation, using memfill.

Parameters:
d The value to write into the image

Definition at line 399 of file image.h.

template<class T>
bool CVD::SubImage< T >::in_image ( const ImageRef ir  )  const [inline]

Is this pixel co-ordinate inside the image?

Parameters:
ir The co-ordinate to test

Definition at line 267 of file image.h.

template<class T>
bool CVD::SubImage< T >::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:
ir The co-ordinate to test
border The size of the border: positive points inside the image.

Definition at line 275 of file image.h.

template<class T>
const T* CVD::SubImage< T >::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.

Definition at line 316 of file image.h.

template<class T>
T* CVD::SubImage< T >::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.

Definition at line 306 of file image.h.

template<class T>
const T& CVD::SubImage< T >::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.

Definition at line 296 of file image.h.

template<class T>
T& CVD::SubImage< T >::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.

Definition at line 287 of file image.h.

template<class T>
ImageRef CVD::SubImage< T >::pos ( const T *  ptr  )  const [inline]

Given a pointer, this returns the image position as an ImageRef.

Definition at line 323 of file image.h.

template<class T>
SubImage& CVD::SubImage< T >::ref (  )  [inline]

Return a reference to a SubImage. Useful for passing anonymous SubImages to functions.

Definition at line 438 of file image.h.

template<class T>
int CVD::SubImage< T >::row_stride (  )  const [inline]

What is the row stride of the image?

Definition at line 380 of file image.h.

template<class T>
ImageRef CVD::SubImage< T >::size (  )  const [inline]

What is the size of this image?

Definition at line 374 of file image.h.

template<class T>
const SubImage CVD::SubImage< T >::sub_image ( const ImageRef start,
const ImageRef size 
) const [inline]

Return const a sub image

Parameters:
start Top left pixel of the sub image
size width and height of the sub image

Definition at line 428 of file image.h.

template<class T>
SubImage CVD::SubImage< T >::sub_image ( const ImageRef start,
const ImageRef size 
) [inline]

Return a sub image

Parameters:
start Top left pixel of the sub image
size width and height of the sub image

Definition at line 418 of file image.h.

template<class T>
int CVD::SubImage< T >::totalsize (  )  const [inline]

What is the total number of elements in the image (i.e. size().x * size().y), including padding.

Definition at line 386 of file image.h.

template<class T>
void CVD::SubImage< T >::zero (  )  [inline]

Set all the pixels in the image to zero. This is a relatively fast operation, using memset.

Definition at line 392 of file image.h.


Member Data Documentation

template<class T>
T* CVD::SubImage< T >::my_data [protected]

The raw image data.

Definition at line 444 of file image.h.

template<class T>
ImageRef CVD::SubImage< T >::my_size [protected]

The size of the image.

Definition at line 445 of file image.h.

template<class T>
int CVD::SubImage< T >::my_stride [protected]

The row stride.

Definition at line 446 of file image.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


libcvd
Author(s): Edward Rosten, Paul Smith, Tom Drummond, Gerhard Reitmayr, Ethan Eade, Timothy Gan, Chris Kemp, Georg Klein
autogenerated on Fri Jan 11 09:13:52 2013