Scan() 공개 메소드

Given a Color image, it is coverted to grayscale OCR-ed and returned
public Scan ( byte>.Image image ) : string
image byte>.Image Source Image to be OCR-ed
리턴 string
예제 #1
0
파일: OCR.cs 프로젝트: Algorithmix/Papyrus
 /// <summary>
 ///   Execute OCR on a given image, this static member will process the image,
 ///   Safely open, execute and dispose a Tesseract Object and store the result
 ///   in a new OcrData object.
 /// </summary>
 /// <param name="original"> Image to be OCR-ed </param>
 /// <param name="mode"> Accuracy setting </param>
 /// <param name="lang"> Language of text for OCR Language Model </param>
 /// <param name="enableTimer"> Measure the Scantime for Diagnostic purposes </param>
 /// <returns> </returns>
 public static OcrData Recognize(Bitmap original,
     Accuracy mode = Accuracy.High,
     string lang = "eng",
     bool enableTimer = false)
 {
     Image<Bgra, byte> img = new Image<Bgra, byte>(original);
     Image<Gray, byte> processed;
     Tesseract.Charactor[] chars;
     String text;
     long confidence;
     long scantime = Int64.MinValue;
     using (OCR ocr = new OCR(mode, lang, enableTimer))
     {
         processed = ocr.Preprocess(img);
         ocr.Scan(processed);
         confidence = ocr.OverallCost();
         chars = ocr.Charactors();
         text = ocr.Text();
         if (enableTimer)
         {
             scantime = ocr.Elapsed();
             ocr.Stop();
         }
     }
     img.Dispose();
     if (scantime == Int64.MinValue)
     {
         return new OcrData(processed, chars, text, confidence);
     }
     return new OcrData(processed, chars, text, confidence, scantime);
 }
예제 #2
0
파일: OCR.cs 프로젝트: Algorithmix/Papyrus
 /// <summary>
 ///   Execute OCR on a given image, this static member will process the image,
 ///   Safely open, execute and dispose a Tesseract Object and store the result
 ///   in a new OcrData object.
 /// </summary>
 /// <param name="original"> Image to be OCR-ed </param>
 /// <param name="mode"> Accuracy setting </param>
 /// <param name="lang"> Language of text for OCR Language Model </param>
 /// <param name="enableTimer"> Measure the Scantime for Diagnostic purposes </param>
 /// <returns> </returns>
 public static OcrData Recognize(Bitmap original,
     Accuracy mode = Accuracy.High,
     string lang = "eng",
     bool enableTimer = false)
 {
     Image<Bgra, byte> img = new Image<Bgra, byte>(original);
     Image<Gray, byte> processed;
     Tesseract.Charactor[] chars;
     String text;
     long confidence;
     long scantime = Int64.MinValue;
     using (OCR ocr = new OCR(mode, lang, enableTimer))
     {
         processed = ocr.Preprocess(img);
         ocr.Scan(processed);
         confidence = ocr.OverallCost();
         chars = ocr.Charactors();
         text = ocr.Text();
         if (enableTimer)
         {
             scantime = ocr.Elapsed();
             ocr.Stop();
         }
     }
     img.Dispose();
     if (scantime == Int64.MinValue)
     {
         return new OcrData(processed, chars, text, confidence);
     }
     return new OcrData(processed, chars, text, confidence, scantime);
 }