Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

52
LINES

< > BotCompany Repo | #1015273 // ocr_recognizeMultiLine_scored

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7592L/51K).

static int ocr_recognizeMultiLine_scored_maxPixels = 100000;
sbool ocr_recognizeMultiLine_scored_filterByMinScore;
static int ocr_recognizeMultiLine_scored_g = 3;

static L<RecognizedText> ocr_recognizeMultiLine_scored(RGBImage img) {
  BWImage bw = new BWImage(img); img = null; ret ocr_recognizeMultiLine_scored(bw);
}

static L<RecognizedText> ocr_recognizeMultiLine_scored(BufferedImage img) {
  BWImage bw = new BWImage(img); img = null; ret ocr_recognizeMultiLine_scored(bw);
}

static L<RecognizedText> ocr_recognizeMultiLine_scored(BWImage bw) {
  SimpleRecognizer sr = filledSimpleRecognizer_cached();
  enableFullSearchInSimpleRecognizer(sr);
  ret ocr_recognizeMultiLine_scored(bw, sr);
}

static L<RecognizedText> ocr_recognizeMultiLine_scored(final BWImage bw, final SimpleRecognizer sr) {
  ret ocr_recognizeMultiLine_scored(bw, sr, autoSegment(bw, ocr_recognizeMultiLine_scored_g));
}

static L<RecognizedText> ocr_recognizeMultiLine_scored(final BWImage bw, L<Rect> _rects) {  
  ret ocr_recognizeMultiLine_scored(bw, simpleRecognizer(), _rects);
}

static L<RecognizedText> ocr_recognizeMultiLine_scored(final RGBImage rgb, L<Rect> _rects) {  
  ret ocr_recognizeMultiLine_scored(new BWImage(rgb), _rects);
}

static L<RecognizedText> ocr_recognizeMultiLine_scored(BufferedImage img, L<Rect> _rects) {  
  ret ocr_recognizeMultiLine_scored(new BWImage(img), _rects);
}

static L<RecognizedText> ocr_recognizeMultiLine_scored(final BWImage bw, final SimpleRecognizer sr, L<Rect> _rects) {  
  final L<Rect> rects = dropRectsLargerThan(ocr_recognizeMultiLine_scored_maxPixels, _rects);
  
  /*new L<RecognizedText> lines;
  for (Rect r : rects)
    lines.add(RecognizedText(r, sr.recognizeScored(bw.clip(r))));
  ret lines;*/
  
  L<RecognizedText> l = parallelMap2(rects, func(Rect r) -> RecognizedText {
    //print(sysNow() + " " + currentThreadID() + rectPixels(r));
    ret RecognizedText(r, sr.recognizeScored(bw.clip(r)));
  });
  if (ocr_recognizeMultiLine_scored_filterByMinScore)
    l = ocr_filterByMinScore(l);
  else
    ocr_clearLinesBelowMinScore(l);
  ret l;
}

Author comment

Began life as a copy of #1006333

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1015273
Snippet name: ocr_recognizeMultiLine_scored
Eternal ID of this version: #1015273/28
Text MD5: c4f6c4bbd0829bfadbaa1366169b2870
Transpilation MD5: c69dad0a8c0295677756574939a1b926
Author: stefan
Category: javax / ocr
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-09-05 23:11:15
Source code size: 2142 bytes / 52 lines
Pitched / IR pitched: No / No
Views / Downloads: 446 / 547
Version history: 27 change(s)
Referenced in: [show references]