public void Execute(Arguments arguments)
        {
            try
            {
                List <System.Drawing.Rectangle> foundRectangles = new List <System.Drawing.Rectangle>();
                using (Bitmap image = (Bitmap)Image.FromFile(arguments.Path.Value))
                {
                    foundRectangles = AForgeWrapper.FindRectangles(
                        image,
                        arguments.Invert.Value,
                        arguments.MinWidth?.Value,
                        arguments.MaxWidth?.Value,
                        arguments.MinHeight?.Value,
                        arguments.MaxHeight?.Value);
                }

                List <Structure> results = new List <Structure>();
                foreach (var foundRectangle in foundRectangles)
                {
                    results.Add(new RectangleStructure(foundRectangle));
                }
                Scripter.Variables.SetVariableValue(arguments.Result.Value, new ListStructure(results));
            }
            catch (Exception ex)
            {
                throw new ApplicationException($"Specified directory doesn't exist. Message: {ex.Message}", ex);
            }
        }
Пример #2
0
 public static void SharpenImage(Bitmap b)
 {
     AForgeWrapper.ApplyMatrix(b, new int[, ] {
         { -1, -1, -1 }, { -1, 9, -1 }, { -1, -1, -1 }
     }, 1);
 }