Example #1
0
 public OcrLocation GetAreaSearch(OcrLocation workingArea)
 {
     if (SearchArea == null)
     {
         return(workingArea);
     }
     return(FromRelative(workingArea, SearchArea.X, SearchArea.XBound, SearchArea.Y, SearchArea.YBound));
 }
Example #2
0
 public static OcrLocation FromRelative(OcrLocation workingArea, double x, double xbound, double y, double ybound)
 {
     return(FromRelative(workingArea, new OcrRelativeSearchLocation()
     {
         X = x,
         XBound = xbound,
         Y = y,
         YBound = ybound
     }));
 }
Example #3
0
        public Image DrawRegion(OcrRegion region, OcrLocation ocrLocation)
        {
            var bmp      = new Bitmap(Source);
            var bluePen  = new Pen(Color.Blue, 3);
            var greenPen = new Pen(Color.Green, 4);

            using (var graphic = Graphics.FromImage(bmp))
            {
                graphic.DrawRectangle(bluePen, region.Location.X, region.Location.Y, region.Location.Width, region.Location.Height);
                graphic.DrawRectangle(greenPen, ocrLocation.X, ocrLocation.Y, ocrLocation.Width, ocrLocation.Height);
            }
            return(bmp);
        }
Example #4
0
 public static OcrLocation FromRelative(OcrLocation workingArea, OcrRelativeSearchLocation loc)
 {
     if (loc.X >= loc.XBound)
     {
         throw new ArgumentOutOfRangeException("X cannot be greater or equal than XBound");
     }
     if (loc.Y >= loc.YBound)
     {
         throw new ArgumentOutOfRangeException("Y cannot be greater or equal than YBound");
     }
     return(new OcrLocation()
     {
         X = (int)(workingArea.Width * loc.X),
         Width = (int)((workingArea.Width * loc.XBound) - (workingArea.Width * loc.X)),
         Y = (int)(workingArea.Height * loc.Y),
         Height = (int)((workingArea.Height * loc.YBound) - (workingArea.Height * loc.Y)),
     });
 }
Example #5
0
 public OcrElement()
 {
     Location = new OcrLocation();
 }