latest version v1.9 - last update 10 Apr 2010 |
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>
Public Member Functions | |
mergeYPbPrToImage (void) | |
~mergeYPbPrToImage () | |
virtual const char * | getTypeName () const |
mergeYPbPrToImage & | copy (const mergeYPbPrToImage &other) |
mergeYPbPrToImage & | operator= (const mergeYPbPrToImage &other) |
virtual functor * | clone () 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 |
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:
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].
lti::mergeYPbPrToImage::mergeYPbPrToImage | ( | void | ) |
Constructor.
lti::mergeYPbPrToImage::~mergeYPbPrToImage | ( | ) |
Destructor.
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.
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.
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().
ubyte lti::mergeYPbPrToImage::clip | ( | const int | val | ) | [inline, static, protected] |
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.
other | the functor to be copied |
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.
other | the functor to be copied |
Reimplemented from lti::mergeImage.
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