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..
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.
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.
We all know converting between RGB and YUV is lossy, but even upsampling the chroma and then downsampling again is not necessarily lossless.
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.
Y, U and V are all allowed to be negative when represented by decimals, according to the YUV color plane.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With