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

37
LINES

< > BotCompany Repo | #1015276 // Recognize test screen shots v1 [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (11402L/82K).

1  
!7
2  
3  
static JNavigation nav;
4  
static File dataDir;
5  
6  
p-noconsole {
7  
  autoRestart();
8  
  nav = jnavigation();
9  
  frameIcon(#1101244, showMaximizedFrame(nav));
10  
  dataDir = javaxDataDir("Screen shots for text recognition");
11  
12  
  // Recognize existing & new  
13  
  onNewFileInDirWithExtension(dataDir, ".png", voidfunc(File f) { recognizeFile(f, true) });
14  
  for (final File f : sortFilesByDateDesc(listPNGFiles(dataDir))) recognizeFile(f, false);
15  
}
16  
17  
svoid recognizeFile(final File f, bool onTop) {
18  
  final BufferedImage img = loadBufferedImage(f);
19  
  print("Recognizing: " + f.getName() + " (" + bufferedImageSizeWithStar(img) + ")");
20  
  long time = sysNow();
21  
  final L<RecognizedText> lines = ocr_recognizeMultiLine_scored(img);
22  
  print("  " + (sysNow()-time) + "  ms");
23  
  F0<JComponent> makeComponent = func -> JComponent {
24  
    final new ImageSurface is;
25  
    is.specialPurposed = true;
26  
    showImageWithRecognizedTexts(img, is, lines);
27  
    
28  
    showImageWithRecognizedTexts_makeTeachable(is, lines, changeExtension(f, ".expected"));
29  
    
30  
    ret jtabs(
31  
      "Picture", jscroll(is),
32  
      "Raw", jtextarea(pnlStructToString(lines))
33  
    );
34  
  };
35  
  
36  
  addToNavPossiblyOnTop(onTop, nav, f.getName(), makeComponent);
37  
}

Author comment

Began life as a copy of #1015275

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: #1015276
Snippet name: Recognize test screen shots v1 [OK]
Eternal ID of this version: #1015276/30
Text MD5: 830372cb69c41bf0bc139ec7e7da1ff6
Transpilation MD5: da7a341f2e01552f35cb1803cf2cac0d
Author: stefan
Category: javax / ocr
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-13 18:48:51
Source code size: 1234 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 371 / 1024
Version history: 29 change(s)
Referenced in: [show references]