by
84k 18
0
5
110k
0
Top 1% !
Pearl of Wisdom
Tagged
Specified
Refined
Popularity: 20081st place

Published on:

Architecturex86_64
InputName0rgb
InputName1ycbcr
InputType0RGB
InputType1YCbCr
LanguageC#
MethodNameFromRGB
OutputTypevoid
Windows VersionWindows7

FromRGB: Convert from RGB to YCbCr color space (Rec 601-1 specification).

Convert from RGB to YCbCr color space (Rec 601-1 specification). 

 
<param name="rgb">Source color in <b>RGB</b> color space.</param>
<param name="ycbcr">Destination color in <b>YCbCr</b> color space.</param>
Copy Embed Code
<iframe id="embedFrame" style="width:600px; height:300px;"
src="https://www.snip2code.com/Embed/1383547/FromRGB--Convert-from-RGB-to-YCbCr-color?startLine=0"></iframe>
Click on the embed code to copy it into your clipboard Width Height
Leave empty to retrieve all the content Start End
/// <summary> /// Convert from RGB to YCbCr color space (Rec 601-1 specification). /// </summary> /// /// <param name="rgb">Source color in <b>RGB</b> color space.</param> /// <param name="ycbcr">Destination color in <b>YCbCr</b> color space.</param> /// public static void FromRGB(RGB rgb, YCbCr ycbcr) { float r = (float)rgb.Red / 255; float g = (float)rgb.Green / 255; float b = (float)rgb.Blue / 255; ycbcr.Y = (float)(0.2989 * r + 0.5866 * g + 0.1145 * b); ycbcr.Cb = (float)(-0.1687 * r - 0.3313 * g + 0.5000 * b); ycbcr.Cr = (float)(0.5000 * r - 0.4184 * g - 0.0816 * b); }
If you want to be updated about similar snippets, Sign in and follow our Channels

blog comments powered by Disqus