Red Viper
Red Viper

Reputation: 507

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?

Upvotes: 14

Views: 32403

Answers (1)

Egor Simonov
Egor Simonov

Reputation: 41

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.

Upvotes: 4

Related Questions