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

lti::mergeYCbCrToImage Class Reference
[Color Analysis]

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

#include <ltiMergeYCbCrToImage.h>

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

List of all members.

Public Member Functions

 mergeYCbCrToImage (void)
 ~mergeYCbCrToImage ()
virtual const char * getTypeName () const
mergeYCbCrToImagecopy (const mergeYCbCrToImage &other)
mergeYCbCrToImageoperator= (const mergeYCbCrToImage &other)
virtual functorclone () const
virtual bool apply (const matrix< float > &Y, const matrix< float > &Cb, const matrix< float > &Cr, image &img) const
virtual bool apply (const channel8 &Y, const channel8 &Cb, const channel8 &Cr, image &img) const
virtual bool apply (const float &Y, const float &Cb, const float &Cr, rgbPixel &pixel) const
virtual bool apply (const ubyte &Y, const ubyte &Cb, const ubyte &Cr, rgbPixel &pixel) const

Protected Member Functions

virtual void initializeLUTs ()
ubyte clip (const int val) const

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 YCbCr 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, YCbCr 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::splitImageToYCbCr is followed:

\[ \begin{bmatrix} R \\ G \\ B \end{bmatrix} = M^{-1} \left( \begin{bmatrix} Y \\ Cb \\ Cr \end{bmatrix} - \begin{bmatrix} 16 \\ 128 \\ 128 \end{bmatrix} \right) \]

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

If you know you have a YCbCr space but it was given to you as YUV, then the equivalences are U=Cb and V=Cr.

A way of noticing if you have a YCbCr color space is determining the range of the values of each channel. Y should be in [16,235], while Cr and Cb should be in [16,240]. If you channel Y has values in [0,255] then you should use mergeYPbPrToImage instead.


Constructor & Destructor Documentation

lti::mergeYCbCrToImage::mergeYCbCrToImage ( void   ) 

Constructor.

lti::mergeYCbCrToImage::~mergeYCbCrToImage (  ) 

Destructor.


Member Function Documentation

bool lti::mergeYCbCrToImage::apply ( const ubyte Y,
const ubyte Cb,
const ubyte Cr,
rgbPixel pixel 
) const [inline, virtual]

Merge the 8-bit-values Y, U and V to a pixel.

Parameters:
Y the Y value, i.e. black&white
Cb the Cb value, chromatic
Cr the Cr value, chromatic
pixel the merged pixel

Implements lti::mergeImage.

References clip(), lutUb, lutUg, lutVg, lutVr, lutY, and lti::rgbPixel::set().

bool lti::mergeYCbCrToImage::apply ( const float &  Y,
const float &  Cb,
const float &  Cr,
rgbPixel pixel 
) const [inline, virtual]

Merge the values Y, Cr and Cb to a pixel.

Parameters:
Y the Y value, i.e. black&white
Cb the Cb value, chromatic
Cr the Cr value, chromatic
pixel the merged pixel

Implements lti::mergeImage.

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

virtual bool lti::mergeYCbCrToImage::apply ( const channel8 Y,
const channel8 Cb,
const channel8 Cr,
image img 
) const [virtual]

Merge 8-bit-channels Y, U, V to an image.

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

Implements lti::mergeImage.

virtual bool lti::mergeYCbCrToImage::apply ( const matrix< float > &  Y,
const matrix< float > &  Cb,
const matrix< float > &  Cr,
image img 
) const [virtual]

Merge channels Y, Cr, Cb to an image.

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

Implements lti::mergeImage.

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

Clip function.

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

Referenced by apply().

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

Returns a pointer to a clone of the functor.

Implements lti::functor.

mergeYCbCrToImage& lti::mergeYCbCrToImage::copy ( const mergeYCbCrToImage 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::mergeYCbCrToImage::getTypeName (  )  const [virtual]

Return the name of this type.

Reimplemented from lti::mergeImage.

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

Initialize the Look-Up-Tables.

mergeYCbCrToImage& lti::mergeYCbCrToImage::operator= ( const mergeYCbCrToImage 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::mergeYCbCrToImage::lutUb [static, protected]

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

Referenced by apply().

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

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

Referenced by apply().

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

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

Referenced by apply().

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

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

Referenced by apply().

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

Look up tables to accelerate conversion YUV -> RGB.

Partial Y results

Referenced by apply().


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