Ejemplo n.º 1
0
    private void RGB2YUV(BitmapData image, int xpos, int ypos)
    {
        int index = 0;

        for (int i = 0; i < 8; i++)
        {
            for (int j = 0; j < 8; j++)
            {
                Color32 pixelColor = image.GetPixelColor(xpos + j, image.height - (ypos + i));
                this.YDU[index] = (((0.299f * pixelColor.r) + (0.587f * pixelColor.g)) + (0.114f * pixelColor.b)) - 128f;
                this.UDU[index] = ((-0.16874f * pixelColor.r) + (-0.33126f * pixelColor.g)) + (0.5f * pixelColor.b);
                this.VDU[index] = ((0.5f * pixelColor.r) + (-0.41869f * pixelColor.g)) + (-0.08131f * pixelColor.b);
                index++;
            }
        }
    }
Ejemplo n.º 2
0
        private void RGB2YUV(BitmapData image, int xpos, int ypos)
        {
            int pos = 0;

            for (int y = 0; y < 8; y++)
            {
                for (int x = 0; x < 8; x++)
                {
                    Color32 C = image.GetPixelColor(xpos + x, image.height - (ypos + y));
                    YDU[pos] = (((0.29900f) * C.r + (0.58700f) * C.g + (0.11400f) * C.b)) - 128;
                    UDU[pos] = (((-0.16874f) * C.r + (-0.33126f) * C.g + (0.50000f) * C.b));
                    VDU[pos] = (((0.50000f) * C.r + (-0.41869f) * C.g + (-0.08131f) * C.b));
                    pos++;
                }
            }
        }
Ejemplo n.º 3
0
 private void RGB2YUV( BitmapData image, int xpos, int ypos)
 {
     int pos = 0;
             for (int y = 0; y < 8; y++)
             {
                     for (int x = 0; x < 8; x++)
                     {
                             Color32 C = image.GetPixelColor(xpos+x, image.height - (ypos+y));
                             YDU[pos]=((( 0.29900f)*C.r +( 0.58700f)*C.g+( 0.11400f)*C.b))-128;
                             UDU[pos]=(((-0.16874f)*C.r +(-0.33126f)*C.g+( 0.50000f)*C.b));
                             VDU[pos]=((( 0.50000f)*C.r +(-0.41869f)*C.g+(-0.08131f)*C.b));
                             pos++;
                     }
             }
 }