CVD 0.8
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes
CVD::SubImage< T > Class Template Reference

A generic image class to manage a block of arbitrarily padded data as an image. More...

#include <image.h>

Inheritance diagram for CVD::SubImage< T >:
CVD::BasicImage< T > CVD::Image< T > CVD::VideoFrame< T > CVD::LocalVideoFrame< T > CVD::V4L1Frame< T > CVD::V4L2FrameT< T > CVD::ColourspaceFrame< T > CVD::DeinterlaceFrame< T > CVD::DiskBuffer2Frame< T > CVD::ServerPushJpegFrame< T > CVD::VideoFileFrame< T >

List of all members.

Public Types

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

Public Member Functions

 SubImage (T *data, const ImageRef &size, int stride)
bool in_image (const ImageRef &ir) const
bool in_image_with_border (const ImageRef &ir, int border) const
 ~SubImage ()
T & operator[] (const ImageRef &pos)
const T & operator[] (const ImageRef &pos) const
T * operator[] (int row)
const T * operator[] (int row) const
ImageRef pos (const T *ptr) const
const T * data () const
T * data ()
iterator begin ()
const_iterator begin () const
iterator end ()
const_iterator end () const
void copy_from (const SubImage< T > &other)
ImageRef size () const
int row_stride () const
int totalsize () const
void zero ()
void fill (const T d)
 SubImage (const SubImage &copyof)
SubImage sub_image (const ImageRef &start, const ImageRef &size)
const SubImage sub_image (const ImageRef &start, const ImageRef &size) const
SubImageref ()

Protected Member Functions

T * end_ptr ()
const T * end_ptr () const

Protected Attributes

T * my_data
ImageRef my_size
int my_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:
TThe 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 254 of file image.h.


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:
dataThe image data in horizontal scanline order
sizeThe size of the image
strideThe row stride (or width, including the padding)

Definition at line 261 of file image.h.

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

Copy constructor.

Parameters:
copyofThe image to copy

Definition at line 412 of file image.h.


Member Function Documentation

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

Is this pixel co-ordinate inside the image?

Parameters:
irThe co-ordinate to test

Definition at line 269 of file image.h.

Referenced by CVD::combineImages(), CVD::copy(), CVD::SubImage< GRADIENT >::operator[](), and CVD::SubImage< GRADIENT >::sub_image().

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:
irThe co-ordinate to test
borderThe size of the border: positive points inside the image.

Definition at line 277 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 289 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 298 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 308 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 318 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:
dThe value to write into the image

Definition at line 404 of file image.h.

Referenced by CVD::Image< GRADIENT >::resize().

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

Return a sub image.

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

Definition at line 423 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:
startTop left pixel of the sub image
sizewidth and height of the sub image

Definition at line 433 of file image.h.


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