Ejemplo n.º 1
0
        public override Image ToUInt8()
        {
            ImageUInt8Gray uint8Image = new ImageUInt8Gray(Width, Height);
            double         multiplier = (double)byte.MaxValue + 1;

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    uint8Image.Gray[x, y] = (byte)(Gray[x, y] * multiplier);
                }
            }
            return(uint8Image);
        }
Ejemplo n.º 2
0
        public override Image ToUInt8()
        {
            ImageUInt8Gray uint8Image = new ImageUInt8Gray(Width, Height);
            long           divider    = ((long)uint.MaxValue + 1) / (byte.MaxValue + 1);

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    uint8Image.Gray[x, y] = (byte)(Gray[x, y] / divider);
                }
            }
            return(uint8Image);
        }