LTI-Lib latest version v1.9 - last update 10 Apr 2010

lti::mergeYPbPrToImage Class Reference
[Color Analysis]

Creates RGB values from given YPbPr values by merging float or ubyte values to an rgbPixel, merging channels(floats) or channel8s(ubytes) to an Image. More...

#include <ltiMergeYPbPrToImage.h>

Inheritance diagram for lti::mergeYPbPrToImage:
Inheritance graph
[legend]
Collaboration diagram for lti::mergeYPbPrToImage:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 mergeYPbPrToImage (void)
 ~mergeYPbPrToImage ()
virtual const char * getTypeName () const
mergeYPbPrToImagecopy (const mergeYPbPrToImage &other)
mergeYPbPrToImageoperator= (const mergeYPbPrToImage &other)
virtual functorclone () const
virtual bool apply (const matrix< float > &Y, const matrix< float > &Pb, const matrix< float > &Pr, image &img) const
virtual bool apply (const channel8 &Y, const channel8 &Pb, const channel8 &Pr, image &img) const
virtual bool apply (const float &Y, const float &Pb, const float &Pr, rgbPixel &pixel) const
virtual bool apply (const ubyte &Y, const ubyte &Pb, const ubyte &Pr, rgbPixel &pixel) const

Protected Member Functions

virtual void initializeLUTs ()

Static Protected Member Functions

static ubyte clip (const int val)

Static Protected Attributes



static const int * lutY
static const int * lutVr
static const int * lutUg
static const int * lutVg
static const int * lutUb

Detailed Description

Creates RGB values from given YPbPr values by merging float or ubyte values to an rgbPixel, merging channels(floats) or channel8s(ubytes) to an Image.

In the literature, technical and scientific, there is often confusion among the color spaces YUV, YPbPr and YPbPr. Poynton in http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html explains that YUV is usually never correctly meant, because the color space normally used for component digital video is the YCbCr (ITU-RS601 or CCIR-601). Other devices use the YPbPr, but the "real" YUV is rarely employed.

The LTI-Lib provides all three spaces:

Here, the inverse transformation of lti::splitImageToYPbPr is followed:

\[ \begin{bmatrix} R \\ G \\ B \end{bmatrix} = M^{-1} \begin{bmatrix} Y \\ Pb \\ Pr \end{bmatrix} \]

where M is the matrix given in lti::splitImageToYPbPr.

If you know you have a YPbPr space but it was given to you as YUV, then the equivalences are U=Pb and V=Pr.

A way of noticing if you have a YPbPr color space is determining the range of the values of each channel. Y should be in [0,1], while Pr and Pb should be in [-0.5,0.5].


Constructor & Destructor Documentation

lti::mergeYPbPrToImage::mergeYPbPrToImage ( void   ) 

Constructor.

lti::mergeYPbPrToImage::~mergeYPbPrToImage (  ) 

Destructor.


Member Function Documentation

bool lti::mergeYPbPrToImage::apply ( const ubyte Y,
const ubyte Pb,
const ubyte Pr,
rgbPixel pixel 
) const [inline, virtual]

Merge the 8-bit-values Y, Pb and Pr to a pixel.

Parameters:
Y the Y value, i.e. black&white
Pb the Pb value, chromatic
Pr the Pr value, chromatic
pixel the merged pixel

Implements lti::mergeImage.

bool lti::mergeYPbPrToImage::apply ( const float &  Y,
const float &  Pb,
const float &  Pr,
rgbPixel pixel 
) const [inline, virtual]

Merge the values Y, Pb and Pr to a pixel.

Parameters:
Y the Y value, i.e. black&white
Pb the Pb value, chromatic
Pr the Pr value, chromatic
pixel the merged pixel

Implements lti::mergeImage.

References clip(), and lti::rgbPixel::set().

virtual bool lti::mergeYPbPrToImage::apply ( const channel8 Y,
const channel8 Pb,
const channel8 Pr,
image img 
) const [virtual]

Merge 8-bit-channels Y, Pb, Pr to an image.

Parameters:
Y the Y channel, i.e. black&white
Pb the Pb channel, chromatic
Pr the Pr channel, chromatic
img the image to be splitted

Implements lti::mergeImage.

virtual bool lti::mergeYPbPrToImage::apply ( const matrix< float > &  Y,
const matrix< float > &  Pb,
const matrix< float > &  Pr,
image img 
) const [virtual]

Merge channels Y, Pb, Pr to an image.

Parameters:
Y the Y channel, i.e. black&white
Pb the Pb channel, chromatic
Pr the Pr channel, chromatic
img the image to be splitted

Implements lti::mergeImage.

ubyte lti::mergeYPbPrToImage::clip ( const int  val  )  [inline, static, protected]

Clip function.

Equivalent to min(255,max(0,val)) but maybe faster

Referenced by apply().

virtual functor* lti::mergeYPbPrToImage::clone (  )  const [virtual]

Returns a pointer to a clone of the functor.

Implements lti::functor.

mergeYPbPrToImage& lti::mergeYPbPrToImage::copy ( const mergeYPbPrToImage other  ) 

Copy data of "other" functor.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::mergeImage.

virtual const char* lti::mergeYPbPrToImage::getTypeName (  )  const [virtual]

Return the name of this type.

Reimplemented from lti::mergeImage.

virtual void lti::mergeYPbPrToImage::initializeLUTs (  )  [protected, virtual]

Initialize the Look-Up-Tables.

mergeYPbPrToImage& lti::mergeYPbPrToImage::operator= ( const mergeYPbPrToImage other  ) 

Alias for copy method.

Parameters:
other the functor to be copied
Returns:
a reference to this functor object

Reimplemented from lti::mergeImage.


Member Data Documentation

const int* lti::mergeYPbPrToImage::lutUb [static, protected]

Partial results with Pb (equivalent to U) for the blue channel computation.

const int* lti::mergeYPbPrToImage::lutUg [static, protected]

Partial results with Pb (equivalent to U) for the green channel computation.

const int* lti::mergeYPbPrToImage::lutVg [static, protected]

Partial results with Pr (equivalent to V) for the green channel computation.

const int* lti::mergeYPbPrToImage::lutVr [static, protected]

Partial results with Pr (equivalent to V) for the red channel computation.

const int* lti::mergeYPbPrToImage::lutY [static, protected]

Look up tables to accelerate conversion YPbPr -> RGB.

Partial Y results


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

Generated on Sat Apr 10 15:27:36 2010 for LTI-Lib by Doxygen 1.6.1