another useful page for YUV<->RGB is this Intel page which goes through MMX optimization of such conversions.
http://cedar.intel.com/cgi-bin/ids.dll/content/content.jsp?cntKey=Legacy::ir...
daniel
tigital writes:
btw, i have a color conversion problem and as people spoke about YUV/RGB colormaps, i may ask for an advice here :
i'm using color conversions from effectv, the formulas are :
/*
- conversion from YUV to RGB
- r = 1.164*(y-16) + 1.596*(v-128);
- g = 1.164*(y-16) - 0.813*(v-128) - 0.391*(u-128);
- b = 1.164*(y-16) + 2.018*(u-128);
- conversion from RGB to 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.071*b + 128
*/
i use exactly the same formula for conversion from the rgb colour model from v4l and i've noticed some differences too compared to directly capturing in yuv.. maybe the standard is not that standard?
this page mentions another formula, along side the one above. maybe you can try that one?
weird...
...I use the following conversions for gamma-corrected RGB and YUV:
Y = 0.299R + 0.587G + 0.114B U = -0.147R - 0.289G + 0.436B = 0.492 ( B - Y ) V = 0.615R - 0.515G - 0.100B = 0.877 ( R - Y )
R = Y + 1.140V G = Y - 0.395U - 0.581V B = Y + 2.032U
...of course, it turns out that it all depends on what the original RGB is in, and differs if it's 16-235 or 0-255 per channel, and whether your going for YUV, YCbCr:HDTV (Y709) or YCbCr:SDTV (Y601)...for the record, the effectv conversions are Y601 based, with RGB channels of 0-255...
another good reference is: http://www.faqs.org/faqs/graphics/colorspace-faq/
l8r,