写了个软件用来计算RGB与YUV互转公式, 输入色彩空间,输出两者互转公式,原理是根据r177协议
后续我会把代码开源出来
"BT709 sRGB D65"
Input:
r=(0.64,0.33)
g=(0.30,0.60)
b=(0.15,0.06)
w=(0.3127,0.3290)
RGB2XYZ Matrix:
0.4124, 0.3576, 0.1805
0.2126, 0.7152, 0.0722
0.0193, 0.1192, 0.9505
XYZ2RGB Matrix:
3.2410, -1.5374, -0.4986
-0.9692, 1.8760, 0.0416
0.0556, -0.2040, 1.0570
RGB2YUV Matrix:
0.2126, 0.7152, 0.0722
-0.1146, -0.3854, 0.5000
0.5000, -0.4542, -0.0458
YUV2RGB Matrix:
1, 0, 1.5747
1, -0.1873, -0.4682
1, 1.8556, 0
"BT2020 625 D65"
Input:
r=(0.708,0.292)
g=(0.170,0.797)
b=(0.131,0.046)
w=(0.3127,0.3290)
RGB2XYZ Matrix:
0.6370, 0.1446, 0.1689
0.2627, 0.6780, 0.0593
0.0000, 0.0281, 1.0610
XYZ2RGB Matrix:
1.7167, -0.3557, -0.2534
-0.6667, 1.6165, 0.0158
0.0176, -0.0428, 0.9421
RGB2YUV Matrix:
0.2627, 0.6780, 0.0593
-0.1396, -0.3604, 0.5000
0.5000, -0.4598, -0.0402
YUV2RGB Matrix:
1, 0, 1.4746
1, -0.1646, -0.5714
1, 1.8814, 0
"BT601 625 D65"
Input:
r=(0.64,0.33)
g=(0.29,0.60)
b=(0.15,0.06)
w=(0.3127,0.3290)
RGB2XYZ Matrix:
0.4306, 0.3415, 0.1784
0.2220, 0.7067, 0.0713
0.0202, 0.1296, 0.9393
XYZ2RGB Matrix:
3.0634, -1.3934, -0.4758
-0.9692, 1.8760, 0.0416
0.0679, -0.2288, 1.0691
RGB2YUV Matrix:
0.2220, 0.7067, 0.0713
-0.1195, -0.3805, 0.5000
0.5000, -0.4542, -0.0458
YUV2RGB Matrix:
1, 0, 1.5560
1, -0.1875, -0.4888
1, 1.8573, 0
"BT601 525 D65"
Input:
r=(0.63,0.34)
g=(0.31,0.595)
b=(0.155,0.070)
w=(0.3127,0.3290)
RGB2XYZ Matrix:
0.3935, 0.3653, 0.1917
0.2124, 0.7011, 0.0866
0.0187, 0.1119, 0.9584
XYZ2RGB Matrix:
3.5060, -1.7398, -0.5441
-1.0690, 1.9778, 0.0352
0.0563, -0.1970, 1.0500
RGB2YUV Matrix:
0.2124, 0.7011, 0.0866
-0.1163, -0.3837, 0.5000
0.5000, -0.4450, -0.0550
YUV2RGB Matrix:
1, 0, 1.5752
1, -0.2256, -0.4772
1, 1.8269, 0
"NTSC C"
Input:
r=(0.6700,0.3300)
g=(0.2100,0.7100)
b=(0.1400,0.0800)
w=(0.31006,0.31616)
RGB2XYZ Matrix:
0.6069, 0.1735, 0.2003
0.2989, 0.5866, 0.1145
-0.0000, 0.0661, 1.1162
XYZ2RGB Matrix:
1.9101, -0.5325, -0.2882
-0.9846, 1.9991, -0.0283
0.0583, -0.1184, 0.8976
RGB2YUV Matrix:
0.2989, 0.5866, 0.1145
-0.1688, -0.3312, 0.5000
0.5000, -0.4184, -0.0816
YUV2RGB Matrix:
1, 0, 1.4022
1, -0.3456, -0.7145
1, 1.7710, 0
D65_P3:
r=(0.6800,0.3200)
g=(0.2650,0.6900)
b=(0.1500,0.0600)
w=(0.3127,0.3290)
RGB2XYZ Matrix: :
0.4866 0.2657 0.1982
0.2290 0.6917 0.0793
0.0000 0.0451 1.0439
XYZ2RGB Matrix: :
2.4935 -0.9314 -0.4027
-0.8295 1.7627 0.0236
0.0358 -0.0762 0.9569
RGB2YUV Matrix: :
0.2290 0.6917 0.0793
-0.1243 -0.3757 0.5000
0.5000 -0.4486 -0.0514
YUV2RGB Matrix: :
1.0000 -0.0000 1.5421
1.0000 -0.2111 -0.5104
1.0000 1.8414 0.0000
DCI_P3:
r=(0.6800,0.3200)
g=(0.2650,0.6900)
b=(0.1500,0.0600)
w=(0.3140,0.3510)
RGB2XYZ Matrix: :
0.4452 0.2771 0.1723
0.2095 0.7216 0.0689
0.0000 0.0471 0.9074
XYZ2RGB Matrix: :
2.7254 -1.0180 -0.4402
-0.7952 1.6897 0.0226
0.0412 -0.0876 1.1009
RGB2YUV Matrix: :
0.2095 0.7216 0.0689
-0.1125 -0.3875 0.5000
0.5000 -0.4564 -0.0436
YUV2RGB Matrix: :
1.0000 -0.0000 1.5810
1.0000 -0.1778 -0.4590
1.0000 1.8622 0.0000