Esempio n. 1
0
        public Rgba32 YuvColorToRgba32(YuvColor c)
        {
            const short lowestVal  = 0;
            const short highestVal = 255;

            var r = (short)(c.Y + 1.370705 * (c.V - 128));
            var g = (short)(c.Y - 0.698001 * (c.V - 128) - 0.337633 * (c.U - 128));
            var b = (short)(c.Y + 1.732446 * (c.U - 128));

            r = r.Clamp(lowestVal, highestVal);
            g = g.Clamp(lowestVal, highestVal);
            b = b.Clamp(lowestVal, highestVal);

            return(new Rgba32((byte)r, (byte)g, (byte)b));
        }
Esempio n. 2
0
 public YuvColor YuvColorToBlackAndWhiteYuvColor(YuvColor c)
 {
     return(new YuvColor {
         Y = c.Y, U = 128, V = 128
     });
 }