YUV与RGB转换关系
2024-05-14
57
0
YUV与RGB之间的转换有两种转换标准,分别为 BT709(高清) 和BT601标准(标清)
BT601 limited range
YUV->RGB
R = Y - 16 + 1.372 * (V - 128)
G = Y - 16 - 0.337 * (U - 128) - 0.699 * (V - 128)
B = Y - 16 + 1.734 * (U - 128)
RGB->YUV
Y = 0.299 * R + 0.587 * G + 0.114 * B + 16
U = -0.173 * R - 0.339 * G + 0.511 * B + 128
V = 0.511 * B - 0.428 * G - 0.083 * B + 128
BT601 full range
YUV->RGB
R = 1.164 * (Y - 16) + 1.596 * (V - 128)
G = 1.164 * (Y - 16) - 0.392 * (U - 128) - 0.812 * (V - 128)
B = 1.164 * (Y - 16) + 2.016 * (U - 128)
RGB->YUV
Y = 0.257 * R + 0.504 * G + 0.098 * B + 16
U = -0.148 * R - 0.291 * G + 0.439 * B + 128
V = 0.439 * R - 0.368 * G - 0.072 * B + 128
BT709 limit range
YUV->RGB
R = Y + 1.5748 * (V - 128)
G = Y - 0.1881 * (U - 128) - 0.4681 * (V - 128)
B = Y + 1.8556 * (U - 128)
RGB->YUV
Y = 0.2126 * R + 0.7152 * G + 0.0722 * B
U = -0.1146 * R - 0.3854 * G + 0.500 * B + 128
V = 0.500 * B - 0.4542 * G - 0.0468 * B + 128
BT709 full range
YUV->RGB
R = 1.1644 * (Y - 16) + 1.7928 * (V - 128)
G = 1.1644 * (Y - 16) - 0.2133 * (U - 128) - 0.533 * (V - 128)
B = 1.1644 * (Y - 16) + 2.1124 * (U - 128)
RGB->YUV
Y = 0.1826 * R + 0.6142 * G + 0.0620 * B + 16
U = -0.1006 * R - 0.3386 * G + 0.4392 * B + 128
V = 0.4392 * B - 0.3989 * G - 0.0403 * B + 128