MapSuiteGisEditor/GisEditorPluginCore/Shares/UIs/Controls/Utils/ColorConverter.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 RGB2YCbCr(RGB rgb, YCbCr ycbcr)
        {
            double r = (double)rgb.Red / 255;
            double g = (double)rgb.Green / 255;
            double b = (double)rgb.Blue / 255;
            ycbcr.Y = 0.2989 * r + 0.5866 * g + 0.1145 * b;
            ycbcr.Cb = -0.1687 * r - 0.3313 * g + 0.5000 * b;
            ycbcr.Cr = 0.5000 * r - 0.4184 * g - 0.0816 * b;
        }
public static void RGB2YCbCr ( RGB rgb , YCbCr ycbcr ) { double r = ( double ) rgb . Red / 255 ; double g = ( double ) rgb . Green / 255 ; double b = ( double ) rgb . Blue / 255 ; ycbcr . Y = 0.2989 * r + 0.5866 * g + 0.1145 * b ; ycbcr . Cb = - 0.1687 * r - 0.3313 * g + 0.5000 * b ; ycbcr . Cr = 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