<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { padding-top: 0 ; padding-bottom: 0 }
 --></style><title>Re: [PD-announce] pdp v0.7</title></head><body>
<blockquote type="cite" cite>&gt; btw, i have a color conversion
problem<br>
&gt; and as people spoke about YUV/RGB colormaps,<br>
&gt; i may ask for an advice here :<br>
&gt;<br>
&gt; i'm using color conversions from effectv, the formulas are :<br>
&gt;<br>
&gt; /*<br>
&gt;&nbsp; * conversion from YUV to RGB<br>
&gt;&nbsp; *&nbsp;&nbsp; r = 1.164*(y-16) + 1.596*(v-128);<br>
&gt;&nbsp; *&nbsp;&nbsp; g = 1.164*(y-16) - 0.813*(v-128) -
0.391*(u-128);<br>
&gt;&nbsp; *&nbsp;&nbsp; b =
1.164*(y-16)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span
></span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +
2.018*(u-128);<br>
&gt;&nbsp; * conversion from RGB to YUV<br>
&gt;&nbsp; *&nbsp;&nbsp; y =&nbsp; 0.257*r + 0.504*g + 0.098*b +
16<br>
&gt;&nbsp; *&nbsp;&nbsp; u = -0.148*r - 0.291*g + 0.439*b + 128<br>
&gt;&nbsp; *&nbsp;&nbsp; v =&nbsp; 0.439*r - 0.368*g - 0.071*b +
128<br>
&gt;&nbsp; */<br>
&gt;<br>
<br>
i use exactly the same formula for conversion from the rgb colour
model from<br>
v4l and i've noticed some differences too compared to directly
capturing in<br>
yuv.. maybe the standard is not that standard?<br>
<br>
this page mentions another formula, along side the one above. maybe
you can<br>
try that one?<br>
</blockquote>
<blockquote type="cite" cite>http://www.fourcc.org/fccyvrgb.htm<br>
</blockquote>
<div>weird...</div>
<div><br></div>
<div>...I use the following conversions for gamma-corrected RGB and
YUV:</div>
<div><br></div>
<div>Y = 0.299R + 0.587G + 0.114B</div>
<div>U = -0.147R - 0.289G + 0.436B</div>
<div>&nbsp; = 0.492 ( B - Y )</div>
<div>V = 0.615R - 0.515G - 0.100B</div>
<div>&nbsp; = 0.877 ( R - Y )</div>
<div><br></div>
<div>R = Y + 1.140V</div>
<div>G = Y - 0.395U - 0.581V</div>
<div>B = Y + 2.032U</div>
<div><br></div>
<div>...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...</div>
<div><br></div>
<div>another good reference is:</div>
<div><font face="Lucida Grande" size="-3"
color="#000000">http://www.faqs.org/faqs/graphics/colorspace-faq/</font
></div>
<div><br></div>
<div>l8r,</div>
<div>jamie</div>
</body>
</html>