Pixels< T, dim > Class Template Reference

This is the base Pixel class for a pixel of any size. More...

#include <Image/PixelsBase.H>

Inheritance diagram for Pixels< T, dim >:
Inheritance graph
[legend]
Collaboration diagram for Pixels< T, dim >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef T ScalarType
typedef promote_trait< T, T >::TP SelfPromoteType

Public Member Functions

 Pixels ()
 initalize an empty pixel
 ~Pixels ()
 generic destructor
 Pixels (const Pixels< T, dim > &pix)
 initalize a pixel with all cell values T
template<class T2 >
 Pixels (const Pixels< T2, dim > &pix)
 initalize a pixel with all cell values T
 Pixels (const T *pix)
 initalize a pixel with all cell values T
 Pixels (const T val)
 initalize a pixel with all cell values T
size_t getDim ()
 get the diminsion of this pixel
template<class T2 >
void setVal (Pixels< T2, dim > &A)
 set the value of this pixel from another pixel, with no conversion
const T & operator[] (const size_t item) const
 get a const array element in this pixel
T & operator[] (const size_t item)
 get an array element in this pixel
T & at (const size_t item)
 get functional access to a pixel element
bool operator== (const Pixels< T, dim > &A) const
 Pixel equality operator.
bool operator!= (const Pixels< T, dim > &A) const
 Pixel inequality operator.
Pixels< T, dim > operator++ ()
 Pixels ++ operator.
Pixels< T, dim > operator-- ()
 Pixels -- operator.

Public Attributes

p [dim]
 pixel info array pointer

Static Public Attributes

static const enum PixType pType = PixTypeBase
static const size_t myDim = dim

Detailed Description

template<class T, size_t dim>
class Pixels< T, dim >

This is the base Pixel class for a pixel of any size.

This class contains all base operators and constructors to create a pixel of any size. To create specific pixel types (i.e. RGB HSV YUV) derive from this class then add the translation functions for typing and constructors.

The base class is mainly used to contain the data and access it raw. Since data from one pixel to another needs to be converted and translated into a different space, all operations between pixels is handled at the level of the derived class to force compile time binding and to make sure that all bindings are handeled correctly.

All pixels have several constant attributes:

const static enum PixType pType - This is an enumeration for the type of pixel this is

const static size_t myDim - This is how many dimensions (dim) I have for the base class and hyper spectral pixels, this is contained in the template parameter dim at declaration.

<size_t dim>=""> - This is applied to Pixels and PixHyper at declaration and contains the diminsion of this pixel

Notes:

(1) size_t is used to hold dimension of the Pixel class. on a 32-bit machine this means that any hyper spectral image is limited to 2^32 pixel componenets (which should be plenty!) (2) Any custom free function for pixels must be accompanied by another free form function for a base type to keep compatability. Thus, if you write a function getBent(Pixels<T>) you must also make a getBent(T) so that it can apply to either a basic type or a pixel type. (3) All pixel types must convert to and from PixRGB so that it can be used as a universal translation pixel type. That is, if you want to convert from type XYZ to ABC you do not need to know the direct translation so long as you can convert from XYZ to RGB and then to ABC. (4) All arithmetic between pixels must convert between color spaces while performing such operations. As such PixRGB = PixRGB + PixHSV will convert the third pixel to a PixRGB type then add it with second pixel this formula. Thus, conversion is implicite in the math. Additionally, all pixels must support such operations with basic types. So PixRGB = PixRGB + float must be supported as well.

Files:

(1) Pixels.H - This file contains the free math functions such as sqrt(Pixel<T>). It also contains free functions for the non-sense relational operators. If you add a pixel type you will only need to make a small change at then end by adding macros for free math functions for your pixel with the PIX_FREE_MATH_FUNCTIONS.

(2) PixelsBase.H - This file. Contains the base class and its methods. If you add a pixel, you will not need to change anything in this file.

(3) PixelsTypes.H - This file contains the derived pixel classes as well as other derived pixel type specific information such as TypeTraits information for each pixel and the static def for each pixels temporary. This file as well as PixelsTypesDefine will require the most change if you add a new type of pixel

(4) Promotions.H - This file contains a macro for creating the proper promotions for basic1 types. Take a look at it. If you add your own pixel type you may want to add the promotions and type trait info here. This is simple and recomended.

(5) test-new-Pixels - This is a very simple binary to test to pixels and make sure they work as they are supposed to.

Current supported Pixel Types:

PixRGB<T> - This is a basic RGB pixel of 3 dimensions. All pixels must be able to convert to and from this type of pixel at the very minumum.

PixHSV<T> - This is a standard HSV pixel type of three dimensions.

PixJpegYUV<T> - This is a YUV pixel of three dimensions, using YUV-for-JPEG conversion conventions.

PixVideoYUV<T> - This is a YUV pixel of three dimensions, using YUV-for-video (MPEG) conversion conventions.

PixYIQ<T> - This is a YIQ pixel of three dimensions.

PixHSL<T> - This is a standard HSL pixel (similar to HSV).

PixH2SV1<T> - This is a pixel derived from HSV with the hue demodulized. It has four dimensions.

PixH2SV2<T> - This is a pixel derived from HSV with the hue demodulized. It has four dimensions. It has a closer resemblance, but a linear one to Red/Green Blue/Yellow opponencie than H2SV1.

PixH2SV3<T> - This is a pixel derived from HSV with the hue demodulized. It has four dimensions. It has a closer resemblance, but a non-linear one to Red/Green Blue/Yellow opponencie than H2SV1. It is currently in the works.

PixHyper<T,dim> - This is a hyper spectral pixel as large as 16^2 dimensions. Some operators are not supported on this pixel type, but will be at a future date.

Definition at line 298 of file PixelsBase.H.


Constructor & Destructor Documentation

template<class T , size_t dim>
Pixels< T, dim >::Pixels (  )  [inline]

initalize an empty pixel

Definition at line 379 of file PixelsBase.H.

References Pixels< T, dim >::p.

template<class T , size_t dim>
Pixels< T, dim >::~Pixels (  )  [inline]

generic destructor

Definition at line 387 of file PixelsBase.H.

template<class T, size_t dim>
Pixels< T, dim >::Pixels ( const Pixels< T, dim > &  pix  )  [inline]

initalize a pixel with all cell values T

Definition at line 392 of file PixelsBase.H.

References Pixels< T, dim >::p.

template<class T , size_t dim>
template<class T2 >
Pixels< T, dim >::Pixels ( const Pixels< T2, dim > &  pix  )  [inline, explicit]

initalize a pixel with all cell values T

Definition at line 400 of file PixelsBase.H.

References Pixels< T, dim >::p.

template<class T, size_t dim>
Pixels< T, dim >::Pixels ( const T *  pix  )  [inline, explicit]

initalize a pixel with all cell values T

Definition at line 408 of file PixelsBase.H.

References Pixels< T, dim >::p.

template<class T, size_t dim>
Pixels< T, dim >::Pixels ( const T  val  )  [inline, explicit]

initalize a pixel with all cell values T

Definition at line 416 of file PixelsBase.H.

References Pixels< T, dim >::p.


Member Function Documentation

template<class T , size_t dim>
T & Pixels< T, dim >::at ( const size_t  item  )  [inline]

get functional access to a pixel element

Definition at line 456 of file PixelsBase.H.

References Pixels< T, dim >::p.

template<class T , size_t dim>
size_t Pixels< T, dim >::getDim (  )  [inline]

get the diminsion of this pixel

Definition at line 427 of file PixelsBase.H.

template<class T, size_t dim>
bool Pixels< T, dim >::operator!= ( const Pixels< T, dim > &  A  )  const [inline]

Pixel inequality operator.

Definition at line 477 of file PixelsBase.H.

References Pixels< T, dim >::p.

template<class T , size_t dim>
Pixels< T, dim > Pixels< T, dim >::operator++ (  )  [inline]

Pixels ++ operator.

Definition at line 490 of file PixelsBase.H.

References Pixels< T, dim >::p.

template<class T , size_t dim>
Pixels< T, dim > Pixels< T, dim >::operator-- (  )  [inline]

Pixels -- operator.

Definition at line 499 of file PixelsBase.H.

References Pixels< T, dim >::p.

template<class T, size_t dim>
bool Pixels< T, dim >::operator== ( const Pixels< T, dim > &  A  )  const [inline]

Pixel equality operator.

Definition at line 466 of file PixelsBase.H.

References Pixels< T, dim >::p.

template<class T , size_t dim>
T & Pixels< T, dim >::operator[] ( const size_t  item  )  [inline]

get an array element in this pixel

Definition at line 449 of file PixelsBase.H.

References Pixels< T, dim >::p.

template<class T , size_t dim>
const T & Pixels< T, dim >::operator[] ( const size_t  item  )  const [inline]

get a const array element in this pixel

Definition at line 442 of file PixelsBase.H.

References Pixels< T, dim >::p.

template<class T , size_t dim>
template<class T2 >
void Pixels< T, dim >::setVal ( Pixels< T2, dim > &  A  )  [inline]

set the value of this pixel from another pixel, with no conversion

Definition at line 434 of file PixelsBase.H.

References Pixels< T, dim >::p.


Member Data Documentation

template<class T, size_t dim>
T Pixels< T, dim >::p[dim]

The documentation for this class was generated from the following file:
Generated on Sun May 8 08:23:49 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3