Beispiel #1
0
        private void DrawBoundingBox(Image image, AABBBoundingBoxItemWithText boundingBoxWithText)
        {
            const int boundingBoxThickness = 5;
            Random    rand            = new Random();
            IPen      pen             = Pens.Solid(Color.FromRgb((byte)rand.Next(byte.MinValue, byte.MaxValue), (byte)rand.Next(byte.MinValue, byte.MaxValue), (byte)rand.Next(byte.MinValue, byte.MaxValue)), boundingBoxThickness);
            IPath     boundingBoxPath = boundingBoxWithText.BoundingBox.AsRectangularPolygon();

            image.Mutate(context =>
            {
                context.Draw(pen, boundingBoxPath);
                context.DrawText(boundingBoxWithText.Text, _textFont, Color.Black, new PointF(boundingBoxWithText.BoundingBox.Min.X, boundingBoxWithText.BoundingBox.Min.Y - (boundingBoxThickness * 3)));
            });
        }
Beispiel #2
0
 private Line GetProperty(AABBBoundingBoxItemWithText boundingBoxWithText, AnalysedImage image)
 {
     foreach (var recognitionResult in image.Result.RecognitionResults)
     {
         foreach (var line in recognitionResult.Lines)
         {
             if (line.BoundingBox.IsIntersecting(boundingBoxWithText.BoundingBox))
             {
                 return(line);
             }
         }
     }
     return(null);
 }