Color conversions¶
work under construction.
to do: http://forum.doom9.org/showthread.php?p=1084293#post1084293
Should cover RGB->YUV conversions and lumarange scaling/preservation and when to use which conversion.
Color conversions¶
coefficients |
Rec.601 |
Rec.709 |
FCC |
---|---|---|---|
Kr : Red channel coefficient |
0.299 |
0.2125 |
0.3 |
Kg : Green channel coefficient |
0.587 |
0.7154 |
0.59 |
Kb : Blue channel coefficient |
0.114 |
0.0721 |
0.11 |
(0.0 <= [Y,R,G,B] <= 1.0) ; (-1.0 < [U,V] < 1.0)
Kg = 1 - Kr - Kb
R = Y + V*(1-Kr) G = Y - U*(1-Kb)*Kb/Kg - V*(1-Kr)*Kr/Kg B = Y + U*(1-Kb)
Converting to programming values¶
YUV [0,255] <-> RGB [0,255] (0 <= [r,g,b] <= 255, 0 <= y <= 255, 0 < [u,v] < 255)
Substituting (Y,V,U,R,G,B) in the equations above and multiplying with 127.5 and respectively 255 gives
YUV [16,235] <-> RGB [0,255] (0 <= [r,g,b] <= 255, 16 <= y <= 235, 16 <= [u,v] <= 240)
References¶
$Date: 2010/02/27 14:45:12 $