Esempio n. 1
0
        protected override void ProcessRecord()
        {
            Int16 pixel = (Int16)((Red << 11) | (Green << 5) | Blue);

            Console.WriteLine($"Pixel value = {pixel}");
            Int16[] pixelList = new Int16[64];
            for (int i = 0; i < pixelList.Length; ++i)
            {
                pixelList[i] = pixel;
            }
            Helper.WriteToFile(pixelList.ConvertToByteArray());
        }
Esempio n. 2
0
        protected override void ProcessRecord()
        {
            Image <Bgr565> image = Image.Load <Bgr565>(PathToImage);

            image.Rotate(_Rotate);
            if (image.Height != 8 || image.Width != 8)
            {
                throw new Exception("Image must be 8x8");
            }

            Int16[] pixelList = new Int16[64];
            int     idx       = 0;   //each iteration increments this value

            for (int columnIdx = 0; columnIdx < image.Height; ++columnIdx)
            {
                for (int rowIdx = 0; rowIdx < image.Width; ++rowIdx)
                {
                    pixelList[idx++] = (Int16)image[rowIdx, columnIdx].PackedValue;
                }
            }
            Helper.WriteToFile(pixelList.ConvertToByteArray());
        }