Exemple #1
0
 public IEnumerable<OCRSegment> DefineSegments()
 {
     AllBorderPoints borderPoints = new AllBorderPoints(labeledPixels, wordOutlinePoints, uploadedDocument);
     foreach(OCRSegment segmentToReturn in handleSegmentsSizes(borderPoints))
         yield return segmentToReturn;
 }
Exemple #2
0
 private IEnumerable<OCRSegment> handleSegmentsSizes(AllBorderPoints borderPoints)
 {
     //DisplayUtility.NewFormForDisplay(borderPoints.listOfPoints, uploadedDocument);
     OCRSegment wordSegment = new OCRSegment();
     foreach (List<Point> wordPointLoop in borderPoints.ReturnWordLoops()) {
         //DisplayUtility.NewFormForDisplay(wordPointLoop, uploadedDocument);
         if (wordPointLoop.Count > 5 && wordPointLoop.Count < 400) { //Test the amount of points in the loop
             wordSegment = defineSegmentObjectToReturn(wordPointLoop);
             if (testSegmentForPlausibilty(wordSegment)) {  //Test the dimensions of the points
                 wordSegment.IsAWord = true;
                 foreach (OCRSegment subSegment in defineSubSegments(wordSegment)) {
                     subSegment.IsAWord = false;
                     SendSegmentToUI(subSegment.InternalPoints, new Rectangle(0, 0, 0, 0)); //TODO: Derive the actual location of the subsegment
                     yield return subSegment;
                 }
                 SendSegmentToUI(wordSegment.InternalPoints, wordSegment.SegmentLocation);
                 yield return wordSegment;
             } else {
                 AllBorderPoints next = new AllBorderPoints(labeledPixels, wordPointLoop, uploadedDocument);
                 handleSegmentsSizes(next);
             }
         }
     }
 }