public static LeadRectD GetBoundingRect(LeadPointD[] points) { double xmin = points[0].X; double ymin = points[0].Y; double xmax = xmin; double ymax = ymin; for (int i = 1; i < points.Length; i++) { if (points[i].X < xmin) { xmin = points[i].X; } if (points[i].X > xmax) { xmax = points[i].X; } if (points[i].Y < ymin) { ymin = points[i].Y; } if (points[i].Y > ymax) { ymax = points[i].Y; } } return(LeadRectD.FromLTRB(xmin, ymin, xmax, ymax)); }
public LeadRectD FromImage(LeadRectD value) { LeadRectD result = LeadRectD.FromLTRB( value.Left / XRatio, value.Top / YRatio, value.Right / XRatio, value.Bottom / YRatio);//, // value.Unit); return(result); }
public LeadRectD ToImage(LeadRectD value) { LeadRectD result = LeadRectD.FromLTRB( value.Left * XRatio, value.Top * YRatio, value.Right * XRatio, value.Bottom * YRatio);//, //value.Unit); return(result); }
private void HighlightWord(Graphics g, int zoneIndex, int wordIndex, Brush b, Pen p) { OcrWord word = _ocrZoneWords[zoneIndex][wordIndex]; // Get the word bounding rectangle and convert to physical so we can draw it on the viewer surface LeadRect rc = LeadRectD.FromLTRB(word.Bounds.Left, word.Bounds.Top, word.Bounds.Right, word.Bounds.Bottom).ToLeadRect(); rc = _imageViewer.ConvertRect(null, ImageViewerCoordinateType.Image, ImageViewerCoordinateType.Control, rc); // Make the rectangle a little bit bigger for visibility purposes rc.Inflate(_wordEdge, _wordEdge); g.FillRectangle(b, Leadtools.Demos.Converters.ConvertRect(rc)); g.DrawRectangle(p, rc.X, rc.Y, rc.Width - 1, rc.Height - 1); }