Exemple #1
0
        private static void GenerateExampleImages(Model generator, int rows, int cols, string filename)
        {
            var(createdImages, _) = GetFakeImages(generator, rows * cols);
            var width  = 30 * cols;
            var height = 30 * rows;
            var data   = new double[width, height];

            for (var x = 0; x < cols; x++)
            {
                for (var y = 0; y < rows; y++)
                {
                    // Start position for this sub-image
                    int sx       = 30 * x + 1;
                    int sy       = 30 * y + 1;
                    var subImage = createdImages.SliceRows(x * rows + y, 1);
                    for (var i = 0; i < 28; i++)
                    {
                        for (var j = 0; j < 28; j++)
                        {
                            var subImageIdx = j * 28 + i;
                            data[sx + i, sy + j] = subImage[subImageIdx];
                        }
                    }
                }
            }
            ImageWriter.GenerateImage(data, filename);
        }