Esempio n. 1
0
        // When done, export images with best location and rotation as png
        private void ExportImages()         // object sender, EventArgs e
        {
            // On complete, expand all shapes with dimension of max width and height.
            var maxWidth = boundaryShape != null
                                ? boundaryShape.BestLocation.X + boundaryShape.ImageRef.Width
                                : 0;
            var maxHeight = boundaryShape != null
                                ? boundaryShape.BestLocation.Y + boundaryShape.ImageRef.Height
                                : 0;

            foreach (var shape in shapes)
            {
                var shapeTotalWidth  = shape.BestLocation.X + shape.ImageRef.Width;
                var shapeTotalHeight = shape.BestLocation.Y + shape.ImageRef.Height;

                if (shapeTotalWidth > maxWidth)
                {
                    maxWidth = shapeTotalWidth;
                }
                if (shapeTotalHeight > maxHeight)
                {
                    maxHeight = shapeTotalHeight;
                }
            }

            AutoCrop.GenerateExpandedImages(expandedTargetFolder, shapes, boundaryShape, maxWidth, maxHeight);
        }
Esempio n. 2
0
        public Form1()
        {
            InitializeTargetFolders(Config.Prefix);

            // If we want to fit clustering within a specific shape, make the error function based on fitness within said space
            boundaryShape = AutoCrop.GenerateBoundaryShape(sourceFolder, targetFolder);
            shapes        = AutoCrop.GenerateShapes(sourceFolder, targetFolder, boundaryShape);

            InitializeComponent();
        }