src/Foundation/Media/Gimela.Media.Imaging/Colors/YCbCr.cs
/// <summary>
/// Convert from YCbCr to RGB color space.
/// </summary>
/// 
/// <param name="ycbcr">Source color in <b>YCbCr</b> color space.</param>
/// <param name="rgb">Destination color in <b>RGB</b> color spacs.</param>
/// 
Convert from YCbCr to RGB color space.
Convert from YCbCr to RGB color space .
public static void ToRGB(YCbCr ycbcr, RGB rgb)
    {
      float r = Math.Max(0.0f, Math.Min(1.0f, (float)(ycbcr.Y + 0.0000 * ycbcr.Cb + 1.4022 * ycbcr.Cr)));
      float g = Math.Max(0.0f, Math.Min(1.0f, (float)(ycbcr.Y - 0.3456 * ycbcr.Cb - 0.7145 * ycbcr.Cr)));
      float b = Math.Max(0.0f, Math.Min(1.0f, (float)(ycbcr.Y + 1.7710 * ycbcr.Cb + 0.0000 * ycbcr.Cr)));
      rgb.Red = (byte)(r * 255);
      rgb.Green = (byte)(g * 255);
      rgb.Blue = (byte)(b * 255);
    }
public static void ToRGB ( YCbCr ycbcr , RGB rgb ) { float r = Math . Max ( 0.0f , Math . Min ( 1.0f , ( float ) ( ycbcr . Y + 0.0000 * ycbcr . Cb + 1.4022 * ycbcr . Cr ) ) ) ; float g = Math . Max ( 0.0f , Math . Min ( 1.0f , ( float ) ( ycbcr . Y - 0.3456 * ycbcr . Cb - 0.7145 * ycbcr . Cr ) ) ) ; float b = Math . Max ( 0.0f , Math . Min ( 1.0f , ( float ) ( ycbcr . Y + 1.7710 * ycbcr . Cb + 0.0000 * ycbcr . Cr ) ) ) ; rgb . Red = ( byte ) ( r * 255 ) ; rgb . Green = ( byte ) ( g * 255 ) ; rgb . Blue = ( byte ) ( b * 255 ) ; }
Convert from YCbCr to RGB color space.
Convert from YCbCr to RGB color space .
// don't warry about zeros. compiler will remove them
ycbcr
YCbCr
Source color in YCbCr
Source color in YCbCr
rgb
RGB
Destination color in RGB
Destination color in RGB