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