Allegro.cc Forums » Programming Questions » RGB to YUV to RGB

 This thread is locked; no one can reply to it.
 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 thisY=.3R+.59G+.11B;U=B-Y;V=R-Ybut what is the conversion from YUV to RGB ? ___________________________The more you talk, the more AJ is right. - ML
 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; ``` ________[ My LD48 entry ] [ My SpeedHack`04 entry ] [ TEAM ALLEGRO ] [ My TINS'05 entry - Snake ]
 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. -- "Do not meddle in the affairs of cats, for they are subtle and will pee on your computer." -- Bruce Graham
 A J Member #3,025 December 2002 Krzysztof Kluczek, i watch Shrek2 for the 1st time tonight..nice avatar ___________________________The more you talk, the more AJ is right. - ML
 Go to: Allegro Development Installation, Setup & Configuration Allegro.cc Comments Off-Topic Ordeals The Depot Game Design & Concepts Programming Questions Recent Threads