|
RGB to YUV to RGB |
A J
Member #3,025
December 2002
|
i read somewhere that converting from RGB to YUV could be done with this Y=.3R+.59G+.11B; but what is the conversion from YUV to RGB ? ___________________________ |
Krzysztof Kluczek
Member #4,191
January 2004
|
Just treat it as three equations and solve it. B=Y+U; R=Y+V; G=(Y-.3R-.11B)/.59;
________ |
Kitty Cat
Member #2,815
October 2002
|
Actually: R = 1.164*(Y - 16) + crv*(V - 128) G = 1.164*(Y - 16) - cgu*(U - 128) - cgv*(V - 128) B = 1.164*(Y - 16) + cbu*(U - 128) // where: /* For SMPTE 170M (NTSC;MPEG-1) */ crv = 1.596f; cbu = 2.018f; cgu = 0.391f; cgv = 0.813f; Assuming input and output is between 0 and 255. You also need to be warry over overflow/underflow and clamp accordingly. -- |
A J
Member #3,025
December 2002
|
Krzysztof Kluczek, i watch Shrek2 for the 1st time tonight.. ___________________________ |
|