last update 20 Sep 2009 |
#include <cvrMergeYPbPrToImage.h>
Public Member Functions | |
mergeYPbPrToImage (void) | |
~mergeYPbPrToImage () | |
const std::string & | name () const |
mergeYPbPrToImage & | copy (const mergeYPbPrToImage &other) |
mergeYPbPrToImage & | operator= (const mergeYPbPrToImage &other) |
virtual mergeYPbPrToImage * | clone () const |
virtual mergeYPbPrToImage * | newInstance () 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_ |
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:
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].
cvr::mergeYPbPrToImage::mergeYPbPrToImage | ( | void | ) |
Constructor.
cvr::mergeYPbPrToImage::~mergeYPbPrToImage | ( | ) |
Destructor.
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.
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.
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.
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] |
mergeYPbPrToImage& cvr::mergeYPbPrToImage::copy | ( | const mergeYPbPrToImage & | other | ) |
virtual void cvr::mergeYPbPrToImage::initializeLUTs | ( | ) | [protected, virtual] |
Initialize the Look-Up-Tables.
const std::string& cvr::mergeYPbPrToImage::name | ( | ) | const [virtual] |
virtual mergeYPbPrToImage* cvr::mergeYPbPrToImage::newInstance | ( | ) | const [virtual] |
mergeYPbPrToImage& cvr::mergeYPbPrToImage::operator= | ( | const mergeYPbPrToImage & | other | ) |
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