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

29
LINES

< > BotCompany Repo | #1015397 // showImageWithRecognizedTexts_makeTeachable2

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

Uses 108K of libraries. Click here for Pure Java version (11556L/84K).

!include once #1015415 // GrabbedImage

//static new ThreadLocal<File> showImageWithRecognizedTexts_makeTeachable2_extraFile;

svoid showImageWithRecognizedTexts_makeTeachable2(final BufferedImage img, final ImageSurface is, final L<RecognizedText> lines, final SimpleRecognizer sr, final Runnable reRecognize) {
  //final File extraFile = optParam(showImageWithRecognizedTexts_makeTeachable2_extraFile);
  
  onImageSurfaceHighlightChange(is, voidfunc(Rect r) {
    RecognizedText rec = findByField(lines, +r);
    setToolTip(is, rec == null ? null : str(ocr_minScoreAdjust(rec.text)));
  });
  
  imageSurfacePopupMenuWhenHighlighted_top(is, voidfunc(JPopupMenu menu, final Rect r) {
    RecognizedText rec = findByField(lines, +r);
    ret if rec == null;
    int score = toIntPercent(ocr_minScoreAdjust(rec.text.score));
    addPopupMenuItem(menu, score + "%. Teach... (" + r.w + "*" + r.h + ")", r {
      assertNotASubclassOfConcept(GrabbedImage);
      new GrabbedImage gi;
      gi.image = new BWImage(clipBufferedImage(img, rec.r));
      ocr_teachPhraseForm(gi, sr, voidfunc(S groupedText) {
        rec.text = scored(groupedText, 1);
        is.repaint();
        pcallF(reRecognize);
      });
    });
    addSeparator(menu);
  });
}

Author comment

Began life as a copy of #1015393

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1015397
Snippet name: showImageWithRecognizedTexts_makeTeachable2
Eternal ID of this version: #1015397/16
Text MD5: 4b2b9ea6713b2c4003c41eae3e019f29
Transpilation MD5: bc37c26b23f5106aa22e2b7f073d0458
Author: stefan
Category: javax / imaging / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-11-10 21:47:07
Source code size: 1273 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 525 / 632
Version history: 15 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)