Download Jar. Transpiled version (11043L) is out of date.
1 | !7 |
2 | |
3 | p-subst { |
4 | autoRestart(); |
5 | JNavigation nav = jnavigation(); |
6 | frameIcon(#1101244, showMaximizedFrame(nav)); |
7 | File dataDir = javaxDataDir("Screen shots for text recognition"); |
8 | |
9 | for (final File f : sortFilesByDateDesc(listPNGFiles(dataDir))) { |
10 | final BufferedImage img = loadBufferedImage(f); |
11 | print("Recognizing: " + f.getName() + " (" + bufferedImageSizeWithStar(img) + ")"); |
12 | long time = sysNow(); |
13 | final L<RecognizedText> lines = ocr_recognizeMultiLine_scored(img); |
14 | print(" " + (sysNow()-time) + " ms"); |
15 | nav.addPage(f.getName(), func -> JComponent { |
16 | final new ImageSurface is; |
17 | is.specialPurposed = true; |
18 | showImageWithRecognizedTexts(img, is, lines); |
19 | |
20 | onImageSurfaceHighlightChange(is, voidfunc(Rect r) { |
21 | RecognizedText rec = findByField(lines, +r); |
22 | setToolTip(is, rec == null ? null : str(rec.text)); |
23 | }); |
24 | |
25 | imageSurfacePopupMenuWhenHighlighted_top(is, voidfunc(JPopupMenu menu, final Rect r) { |
26 | final RecognizedText rec = findByField(lines, +r); |
27 | addPopupMenuItem(menu, "OK: " + rec.text!, r { |
28 | appendToTextFile_uniq(changeExtension(f, ".expected"), |
29 | struct(ll(rec.text!, rec.r))); |
30 | }); |
31 | addSeparator(menu); |
32 | }); |
33 | |
34 | ret jtabs( |
35 | "Picture", jscroll(is), |
36 | "Raw", jtextarea(pnlStructToString(lines)) |
37 | ); |
38 | }); |
39 | } |
40 | } |
Began life as a copy of #1015276
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: | #1015309 |
Snippet name: | Recognize test screen shots v2 [dev.] |
Eternal ID of this version: | #1015309/5 |
Text MD5: | e06ab7478f3b85c790c1edbeec5a2f94 |
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-12 18:12:48 |
Source code size: | 1432 bytes / 40 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 408 / 923 |
Version history: | 4 change(s) |
Referenced in: | [show references] |