src/Foundation/Media/Gimela.Media.Imaging/Colors/YCbCr.cs
/// <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>
/// 
Convert from RGB to YCbCr color space (Rec 601-1 specification).
Convert from RGB to YCbCr color space ( Rec 601 - 1 specification ) .
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);
    }
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 ) ; }
Convert from RGB to YCbCr color space (Rec 601-1 specification).
Convert from RGB to YCbCr color space ( Rec 601 - 1 specification ) .
rgb
RGB
Source color in RGB
Source color in RGB
ycbcr
YCbCr
Destination color in YCbCr
Destination color in YCbCr