Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deal with RGB to YUV conversion

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..

like image 723
maximus Avatar asked May 25 '10 14:05

maximus


People also ask

How do you convert RGB to YUV?

To convert from RGB to YUV or back, it is simplest to use RGB888 and YUV444. For YUV411, YUV422 and YUV420, the bytes need to be converted to YUV444 first.

Why is YUV better than RGB?

YUV color-spaces are a more efficient coding and reduce the bandwidth more than RGB capture can. Most video cards, therefore, render directly using YUV or luminance/chrominance images. The most important component for YUV capture is always the luminance, or Y component.

Is RGB to YUV Lossless?

We all know converting between RGB and YUV is lossy, but even upsampling the chroma and then downsampling again is not necessarily lossless.

Is YUV the same as RGB?

Mathematically Equivalent to RGB YUV also saves transmission bandwidth compared to RGB, because the chroma channels (B-Y and R-Y) carry only half the resolution of the luma. YUV is not compressed RGB; rather, Y, B-Y and R-Y are the mathematical equivalent of RGB.


1 Answers

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

YUV Color space

like image 98
Dolph Avatar answered Oct 02 '22 07:10

Dolph