CVR-Lib last update 20 Sep 2009

cvr::mergeYPbPrToImage Class Reference
[Color Analysis]

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

#include <cvrMergeYPbPrToImage.h>

Inheritance diagram for cvr::mergeYPbPrToImage:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

 mergeYPbPrToImage (void)
 ~mergeYPbPrToImage ()
const std::string & name () const
mergeYPbPrToImagecopy (const mergeYPbPrToImage &other)
mergeYPbPrToImageoperator= (const mergeYPbPrToImage &other)
virtual mergeYPbPrToImageclone () const
virtual mergeYPbPrToImagenewInstance () const
virtual bool apply (const matrix< float > &Y, const matrix< float > &Pb, const matrix< float > &Pr, image &img) const
virtual bool apply (const matrix< ubyte > &Y, const matrix< ubyte > &Pb, const matrix< ubyte > &Pr, image &img) const
virtual bool apply (const float &Y, const float &Pb, const float &Pr, rgbaPixel &pixel) const
virtual bool apply (const ubyte &Y, const ubyte &Pb, const ubyte &Pr, rgbaPixel &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 rgbaPixel, 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 CVR-Lib provides all three spaces:

Here, the inverse transformation of cvr::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 cvr::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

cvr::mergeYPbPrToImage::mergeYPbPrToImage ( void   ) 

Constructor.

cvr::mergeYPbPrToImage::~mergeYPbPrToImage (  ) 

Destructor.


Member Function Documentation

virtual bool cvr::mergeYPbPrToImage::apply ( const ubyte Y,
const ubyte Pb,
const ubyte Pr,
rgbaPixel 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 cvr::mergeImage.

virtual bool cvr::mergeYPbPrToImage::apply ( const float &  Y,
const float &  Pb,
const float &  Pr,
rgbaPixel 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 cvr::mergeImage.

virtual bool cvr::mergeYPbPrToImage::apply ( const matrix< ubyte > &  Y,
const matrix< ubyte > &  Pb,
const matrix< ubyte > &  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 cvr::mergeImage.

virtual bool cvr::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 cvr::mergeImage.

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

Clip function.

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

virtual mergeYPbPrToImage* cvr::mergeYPbPrToImage::clone (  )  const [virtual]

Returns a pointer to a clone of the functor.

Implements cvr::mergeImage.

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

Copy data of "other" functor.

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

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

Initialize the Look-Up-Tables.

const std::string& cvr::mergeYPbPrToImage::name (  )  const [virtual]

Return the name of this type.

Implements cvr::functor.

virtual mergeYPbPrToImage* cvr::mergeYPbPrToImage::newInstance (  )  const [virtual]

Returns a pointer to a new instance of this functor.

Implements cvr::mergeImage.

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

Alias for copy method.

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


Member Data Documentation

const int* cvr::mergeYPbPrToImage::lutUb_ [static, protected]

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

const int* cvr::mergeYPbPrToImage::lutUg_ [static, protected]

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

const int* cvr::mergeYPbPrToImage::lutVg_ [static, protected]

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

const int* cvr::mergeYPbPrToImage::lutVr_ [static, protected]

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

const int* cvr::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 Sun Sep 20 22:08:51 2009 for CVR-Lib by Doxygen 1.5.8