Exemple #1
0
        static public YCbCr[,] ToYcbcr(Bitmap bmp)
        {
            var ycbcrBitmap = new YCbCr[512, 512];

            using (var fastBitmap = bmp.FastLock())
            {
                for (var y = 0; y < 512; y++)
                {
                    for (var x = 0; x < 512; x++)
                    {
                        ycbcrBitmap[x, y] = ToYcbcr(fastBitmap.GetPixel(x, y));
                    }
                }
            }
            return(ycbcrBitmap);
        }
Exemple #2
0
 static public Color ToRgb(YCbCr ycbcr)
 {
     return(Color.FromArgb(ToR(ycbcr), ToG(ycbcr), ToB(ycbcr)));
 }
Exemple #3
0
 static public byte ToG(YCbCr ycbcr)
 {
     return(NormalizeByte((int)Math.Round(ycbcr.Y - (5329.0 / 15481) * (ycbcr.Cb - 128) - (11103.0 / 15481) * (ycbcr.Cr - 128))));
 }
Exemple #4
0
 static public byte ToB(YCbCr ycbcr)
 {
     return(NormalizeByte((int)Math.Round(ycbcr.Y + (256.0 / 144) * (ycbcr.Cb - 128))));
 }
Exemple #5
0
 private void ToY()
 {
     RightPictureWrapper.Image = YCbCr.ToRgb(YCbCr.ToYcbcr(new Bitmap(LeftPictureWrapper.Image)));
 }