Esempio n. 1
0
 private HeuristicSet ExtractHeursitics(int midpoint)
 {
     HeuristicSet heuristics = new HeuristicSet();
     int idx = midpoint - 6;
     int width = Boards.First().Matrix[0].Length;
     heuristics.GoThroughBoards(Boards, new Rectangle(idx, 0, Segmentation.Segmentator.WidthOfCanvas, width));
     return heuristics;
 }
Esempio n. 2
0
 public static IEnumerable<HeuristicSet> Segment(this IterateBoards boards)
 {
     int width = boards.Boards.First().Matrix.Length;
     int height = boards.Boards.First().Matrix[0].Length;
     for (int idx = 0; idx < width - WidthOfCanvas; idx++) {
         var heuristics = new HeuristicSet { Bounds = new Rectangle(idx, 0, Segmentator.WidthOfCanvas, Segmentator.HeightOfCanvas) };
         heuristics.GoThroughBoards(boards.Boards, heuristics.Bounds);
         yield return heuristics;
     }
 }
Esempio n. 3
0
 public HeuristicSet GetLetterHeuristics(BoundedCharacter ch)
 {
     var rect = ch.Bounds.ToGdi();
     int midpoint = rect.X + (int)Math.Round(rect.Width / 2d);
     Rectangle smallerRect = new Rectangle(midpoint - Segmentator.PointerOffset, 0, Segmentator.WidthOfCanvas, Segmentator.HeightOfCanvas);
     HeuristicSet heursitics = new HeuristicSet { Bounds = rect, Label = ch.Character.ToString() };
     heursitics.GoThroughBoards(Boards, smallerRect);
     Bitmap b = Boards.First().Matrix.ExtractRectangularContentArea(smallerRect).ConvertDoubleArrayToBitmap(Color.White);
     b.Log(ch.Character.ToString(), smallerRect);
     return heursitics;
 }
Esempio n. 4
0
 public HeuristicSet GetSpaceHeuristics(BoundedCharacter ch1, BoundedCharacter ch2)
 {
     var rect1 = ch1.Bounds.ToGdi();
     var rect2 = ch2.Bounds.ToGdi();
     int midpoint = rect1.Right + (rect2.X - rect1.Right) / 2;
     Rectangle smallerRect = new Rectangle(midpoint - Segmentator.PointerOffset, 0, Segmentator.WidthOfCanvas, Segmentator.HeightOfCanvas);
     HeuristicSet heursitics = new HeuristicSet { Bounds = smallerRect, Label = "whitespace" };
     heursitics.GoThroughBoards(Boards, smallerRect);
     Bitmap b = Boards.First().Matrix.ExtractRectangularContentArea(smallerRect).ConvertDoubleArrayToBitmap(Color.White);
     b.Log("whitespace", smallerRect);
     return heursitics;
 }