Y = Kry· R + Kgy· G + Kby· B(R,G,B代表RGB色彩空间的红色,绿色,蓝色)
Cb= B – Y (Cb是差值)
Cr= R – Y(Cr是差值)
Kry+ Kgy+ Kby= 1(K 是比值或称权重, BT.601, BT.709,BT.2020中的权重是不同的。)
来自 <https://www.cnblogs.com/huxiaopeng/p/5653257.html>
1.模拟YUV->模拟RGB
1) BT601(标清国际定义)
12345678 | //*********************BT601***********************************//// Y = 0.299 * R + 0.587 * G + 0.114 * B //// Pb =-0.169 * R – 0.331 * G + 0.500 * B //// Pr = 0.500 * R – 0.439 * G – 0.081 * B //// R = Y + 1.402* Pr //// G = Y – 0.344 * Pb – 0.792* Pr //// B = Y + 1.772 * Pb ////*********************BT601***********************************// |
2)BT709(高清)
12345678 | //*********************BT601***********************************//// Y = 0.213 * R + 0.715 * G + 0.072 * B //// Pb =-0.115 * R – 0.385 * G + 0.500 * B //// Pr = 0.500 * R – 0.454 * G – 0.046 * B //// R = Y + 1.402* Cr //// G = Y – 0.344 * Cb – 0.792* Cr //// B = Y + 1.772 * Cb ////*********************BT601***********************************// |
2 数字YUV->数字RGB
1)BT601
12345678 | //*********************BT601***********************************//// Y = 16 + 0.257 * R + 0.504 * g + 0.098 * b //// Cb = 128 – 0.148 * R – 0.291 * g + 0.439 * b //// Cr = 128 + 0.439 * R – 0.368 * g – 0.071 * b //// R = 1.164 *(Y – 16) + 1.596 *(Cr – 128) //// G = 1.164 *(Y – 16) – 0.392 *(Cb – 128) – 0.812 *(Cr – 128)//// B = 1.164 *(Y – 16) + 2.016 *(Cb – 128) ////*********************BT601***********************************// |
2)BT709
12345678 | //*********************BT709***********************************//// Y = 16 + 0.183 * R + 0.614 * g + 0.062 * b //// Cb = 128 – 0.101 * R – 0.339 * g + 0.439 * b //// Cr = 128 + 0.439 * R – 0.399 * g – 0.040 * b //// R = 1.164 *(Y – 16) + 1.792 *(Cr – 128) //// G = 1.164 *(Y – 16) – 0.213 *(Cb – 128) – 0.534 *(Cr – 128)//// B = 1.164 *(Y – 16) + 2.114 *(Cb – 128) ////*********************BT709***********************************// |
来自 <https://www.cnblogs.com/zhengjianhong/p/7872459.html>
模拟RGB转YUV的推导公式 :
1234 | Wr + Wg + Wb = 1; UMax = 0.5; VMax = 0.5Y = Wr * R + Wg * G + Wb * B;Pb = Umax * (B – Y) / (1 – Wb);Pr = Vmax * (R – Y) / (1 – Wr); |
数字RGB转YUV的推导公式:
1234 | Wr + Wg + Wb = 1; Umax = Vmax = 0.5;Y = 16 + 219 * (Wr * R + Wg * G + Wb * B) / 255;Cb = 128 + 224 * (Umax * (B – Y) / (1 – Wb)) / 255;Cr = 128 + 224 * (Vmax * (R – Y) / (1 – Wr)) / 255; |
BT601 Wr = 0.299 Wg = 0.587 Wb = 0.114
BT709 Wr = 0.2126 Wg = 0.7152 Wb = 0.0722
BT2020 Wr = 0.2627 Wg = 0.678 Wb = 0.0593
来自 <https://www.cnblogs.com/zhengjianhong/p/7872459.html>
BT.601
BT.709
转载请注明:《YUV 色彩空间的多种转换矩阵》