CVR-Lib last update 20 Sep 2009

cvr::splitImageToYCbCr Class Reference
[Color Analysis]

Computes the YCbCr values from a given RGB color representation (rgbaPixel). More...

#include <cvrSplitImageToYCbCr.h>

Inheritance diagram for cvr::splitImageToYCbCr:

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

Collaboration graph
[legend]

List of all members.

Public Member Functions

 splitImageToYCbCr ()
 splitImageToYCbCr (const splitImageToYCbCr &other)
virtual ~splitImageToYCbCr ()
const std::string & name () const
splitImageToYCbCrcopy (const splitImageToYCbCr &other)
splitImageToYCbCroperator= (const splitImageToYCbCr &other)
virtual splitImageToYCbCrclone () const
virtual splitImageToYCbCrnewInstance () const
virtual bool apply (const rgbaPixel &pixel, float &c1, float &c2, float &c3) const
virtual bool apply (const rgbaPixel &pixel, ubyte &c1, ubyte &c2, ubyte &c3) const
virtual bool apply (const matrix< rgbaPixel > &img, matrix< float > &c1, matrix< float > &c2, matrix< float > &c3) const
virtual bool apply (const matrix< rgbaPixel > &img, matrix< ubyte > &c1, matrix< ubyte > &c2, matrix< ubyte > &c3) const


Detailed Description

Computes the YCbCr values from a given RGB color representation (rgbaPixel).

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 CVR-Lib provides all three spaces:

This functor splits an RGB images into the color space YCbCr (ITU-RS601) using the conversion equations given by the above mentioned reference:

\[ \begin{bmatrix} Y \\ Cb \\ Cr \end{bmatrix} = \begin{bmatrix} 16 \\ 128 \\ 128 \end{bmatrix} + \frac{1}{255} \begin{bmatrix} 65.481 & 128.553 & 24.966 \\ -37.797 & -74.203 & 112 \\ 112 & -93.786 & -18.214 \end{bmatrix} \begin{bmatrix} R \\ G \\ B \end{bmatrix} \]

Note that the Y values will have an excursion of 219 with an offset of 16, while the Cb and Cr values will have an excursion of +/-112 with an offset of 128.

The Cb value corresponds to U, and Cr to V, in case you need to provide them with "wrong" names.


Constructor & Destructor Documentation

cvr::splitImageToYCbCr::splitImageToYCbCr (  ) 

default constructor

cvr::splitImageToYCbCr::splitImageToYCbCr ( const splitImageToYCbCr other  ) 

copy constructor

Parameters:
other the object to be copied

virtual cvr::splitImageToYCbCr::~splitImageToYCbCr (  )  [virtual]

destructor


Member Function Documentation

virtual bool cvr::splitImageToYCbCr::apply ( const matrix< rgbaPixel > &  img,
matrix< ubyte > &  c1,
matrix< ubyte > &  c2,
matrix< ubyte > &  c3 
) const [virtual]

Split image into 8-bit channels.

N.B.: when casting the transformation result to unsigned shorts (8-bit channel) major rounding errors will occur.

As a result, the merging operation might produce negative values or values > 1, which are truncated subsequently. When accurate Y, U and V values are required, prefer float values.

virtual bool cvr::splitImageToYCbCr::apply ( const matrix< rgbaPixel > &  img,
matrix< float > &  c1,
matrix< float > &  c2,
matrix< float > &  c3 
) const [virtual]

split pixel into float channels

virtual bool cvr::splitImageToYCbCr::apply ( const rgbaPixel pixel,
ubyte c1,
ubyte c2,
ubyte c3 
) const [inline, virtual]

Split pixel into 8-bit values (between 0 and 255).

N.B.: when casting the transformation result to unsigned shorts (8-bit channel) major rounding errors will occur.

As a result, the merging operation might produce negative values or values > 1, which are truncated subsequently.

When accurate Y, U and V values are required, prefer float values

Implements cvr::splitImage.

virtual bool cvr::splitImageToYCbCr::apply ( const rgbaPixel pixel,
float &  c1,
float &  c2,
float &  c3 
) const [inline, virtual]

split pixel into float values (between 0 and 1)

Implements cvr::splitImage.

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

returns a pointer to a clone of this functor.

Implements cvr::splitImage.

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

copy data of "other" functor.

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

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

returns the name of this type ("splitImageToYCbCr")

Implements cvr::functor.

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

Returns a pointer to a new instance of this functor.

Implements cvr::splitImage.

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

alias for copy member

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


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

Generated on Sun Sep 20 22:08:52 2009 for CVR-Lib by Doxygen 1.5.8