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).

1  
!include once #1015415 // GrabbedImage
2  
3  
//static new ThreadLocal<File> showImageWithRecognizedTexts_makeTeachable2_extraFile;
4  
5  
svoid showImageWithRecognizedTexts_makeTeachable2(final BufferedImage img, final ImageSurface is, final L<RecognizedText> lines, final SimpleRecognizer sr, final Runnable reRecognize) {
6  
  //final File extraFile = optParam(showImageWithRecognizedTexts_makeTeachable2_extraFile);
7  
  
8  
  onImageSurfaceHighlightChange(is, voidfunc(Rect r) {
9  
    RecognizedText rec = findByField(lines, +r);
10  
    setToolTip(is, rec == null ? null : str(ocr_minScoreAdjust(rec.text)));
11  
  });
12  
  
13  
  imageSurfacePopupMenuWhenHighlighted_top(is, voidfunc(JPopupMenu menu, final Rect r) {
14  
    RecognizedText rec = findByField(lines, +r);
15  
    ret if rec == null;
16  
    int score = toIntPercent(ocr_minScoreAdjust(rec.text.score));
17  
    addPopupMenuItem(menu, score + "%. Teach... (" + r.w + "*" + r.h + ")", r {
18  
      assertNotASubclassOfConcept(GrabbedImage);
19  
      new GrabbedImage gi;
20  
      gi.image = new BWImage(clipBufferedImage(img, rec.r));
21  
      ocr_teachPhraseForm(gi, sr, voidfunc(S groupedText) {
22  
        rec.text = scored(groupedText, 1);
23  
        is.repaint();
24  
        pcallF(reRecognize);
25  
      });
26  
    });
27  
    addSeparator(menu);
28  
  });
29  
}

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: 439 / 526
Version history: 15 change(s)
Referenced in: [show references]