last update 20 Sep 2009 |
#include <cvrSplitImageToYPbPr.h>
Public Member Functions | |
splitImageToYPbPr () | |
splitImageToYPbPr (const splitImageToYPbPr &other) | |
virtual | ~splitImageToYPbPr () |
const std::string & | name () const |
splitImageToYPbPr & | copy (const splitImageToYPbPr &other) |
splitImageToYPbPr & | operator= (const splitImageToYPbPr &other) |
virtual splitImageToYPbPr * | clone () const |
virtual splitImageToYPbPr * | newInstance () 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 |
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 YPbPr using the conversion equations given by the above mentioned reference:
In the formula above, RGB have been assumed to be in the intervall [0,1]. With it, the Y values will have also be in [0,1], while Pb and Pr will lie between [-0.5 and 0.5]. For the ubyte types an offset of 128 is added to the Pb and Pr values, which are previously scaled by 255.
cvr::splitImageToYPbPr::splitImageToYPbPr | ( | ) |
default constructor
cvr::splitImageToYPbPr::splitImageToYPbPr | ( | const splitImageToYPbPr & | other | ) |
virtual cvr::splitImageToYPbPr::~splitImageToYPbPr | ( | ) | [virtual] |
destructor
virtual bool cvr::splitImageToYPbPr::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::splitImageToYPbPr::apply | ( | const matrix< rgbaPixel > & | img, | |
matrix< float > & | c1, | |||
matrix< float > & | c2, | |||
matrix< float > & | c3 | |||
) | const [virtual] |
split pixel into float channels
virtual bool cvr::splitImageToYPbPr::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::splitImageToYPbPr::apply | ( | const rgbaPixel & | pixel, | |
float & | c1, | |||
float & | c2, | |||
float & | c3 | |||
) | const [inline, virtual] |
virtual splitImageToYPbPr* cvr::splitImageToYPbPr::clone | ( | ) | const [virtual] |
splitImageToYPbPr& cvr::splitImageToYPbPr::copy | ( | const splitImageToYPbPr & | other | ) |
const std::string& cvr::splitImageToYPbPr::name | ( | ) | const [virtual] |
virtual splitImageToYPbPr* cvr::splitImageToYPbPr::newInstance | ( | ) | const [virtual] |
splitImageToYPbPr& cvr::splitImageToYPbPr::operator= | ( | const splitImageToYPbPr & | other | ) |