예제 #1
0
 private HeuristicReturnValues ExtractHeursitics(int midpoint)
 {
     HeuristicReturnValues heuristics = new HeuristicReturnValues();
     int idx = midpoint - 6;
     int width = Boards.First().Matrix[0].Length;
     heuristics.GoThroughBoards(Boards, new Rectangle(idx, 0, Segmentation.WidthOfCanvas, width));
     return heuristics;
 }
예제 #2
0
 public static IEnumerable<HeuristicReturnValues> Segment(this IteratedBoards boards)
 {
     HeuristicReturnValues heuristics = new HeuristicReturnValues();
     int width = boards.Boards.First().Matrix.Length;
     int height = boards.Boards.First().Matrix[0].Length;
     for (int idx = 0; idx < width - WidthOfCanvas; idx++) {
         heuristics.GoThroughBoards(boards.Boards, new Rectangle(idx, 0, Segmentation.WidthOfCanvas, height));
         yield return heuristics;
     }
 }
예제 #3
0
 public TrainingData Train(CharacterBounds charBounds)
 {
     int midpoint;
     int boardWidth = Boards.First().Matrix.Length;
     TrainingData trainingData = new TrainingData();
     for (int idx = 0; idx < charBounds.items.Count(); idx++ ){
         LetterAndBounds character = charBounds.items[idx];
         midpoint = character.Bounds.X + (int)Math.Round(character.Bounds.Width / 2d);
         Rectangle rect = new Rectangle(midpoint - 6, 0, character.Bounds.Width, character.Bounds.Height);
         HeuristicReturnValues heursitics = new HeuristicReturnValues();
         heursitics.GoThroughBoards(Boards, rect);
         string label = character.Letter;
         if (idx < charBounds.Word.Count()) {
             char newChar = UnicodeConversion.convertUnicodeChar(charBounds.Word, ref idx);
             heursitics.Label = newChar.ToString();
             trainingData.AddHeuristics(heursitics);
         }
     }
     return trainingData;
 }