How to deal with RGB to YUV conversion

maximus picture maximus · May 25, 2010 · Viewed 24.8k times · Source

The formula says:

Y = 0.299 * R + 0.587 * G + 0.114 * B;

U = -0.14713 * R - 0.28886 * G + 0.436 * B;

V = 0.615 * R - 0.51499 * G - 0.10001 * B;

What if, for example, the U variable becomes negative?

U = -0.14713 * R - 0.28886 * G + 0.436 * B;

Assume maximum values for R and G (ones) and B = 0 So, I am interested in implementing this convetion function in OpenCV, So, how to deal with negative values? Using float image? anyway please explain me, may be I don't understand something..

Answer

Dolph picture Dolph · May 25, 2010

Y, U and V are all allowed to be negative when represented by decimals, according to the YUV color plane.

YUV Color space