Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Conversion formula from RGB to YCbCr

Whats the real conversion formula for this because I found so many ways on how to convert I don't know which one is real

From wikipedia: enter image description here

From microsoft https://msdn.microsoft.com/en-us/library/ff635643.aspx enter image description here:

and microsoft is the same with this conversion site http://www.equasys.de/colorconversion.html:

enter image description here

Can anybody explain the difference of the formula?

like image 633
Red Viper Avatar asked Feb 24 '16 06:02

Red Viper


1 Answers

If it still actual they are almost the same. Differences are what value ranges you'll get in the result.

From Wiki's matrix (R',G',B' = 0..1) values will be: Y = 0..219, Cb = -112..112, Cr = -112..112. You can bring it to other matrices with dividing Y formula by 219, and Cb, Cr fomulas by 224.

From Microsoft's one (R,G,B = 0..255) you'll get Y = 0..255, Cb ≈ -127.5 .. 127.5, Cr ≈ -127.5 .. 127.5

The third matrix solves problems with negative numbers by adding 128 to them. The difference from Microsoft's matrix lies in the matrices multiplication.

like image 159
Egor Simonov Avatar answered Oct 19 '22 07:10

Egor Simonov