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

25
LINES

< > BotCompany Repo | #1005950 // Try auto-finding & recognizing characters

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

Libraryless. Click here for Pure Java version (4041L/27K/84K).

1  
!752
2  
3  
p {
4  
  BWImage img = shootScreenBW();
5  
  
6  
  Class loader = hotwire("#1005947");
7  
  call(loader, "getData");
8  
  Map<S, L<S>> md5ToChar = (Map) get(get(loader, "md5ToChar"), "data");
9  
  
10  
  int g = 3;
11  
  L<Rect> clips = autoSegment(img, g);
12  
  new L<Rect> chars;
13  
  for (Rect r : clips) {
14  
    new StringBuffer buf;
15  
    BWImage lineImg = img.clip(r);
16  
    for (Rect c : horizontalAutoSplit2ThenAutoCrop(lineImg)) {
17  
      chars.add(translateRect(c, r.x, r.y));
18  
      BWImage charImg = lineImg.clip(c);
19  
      S md5 = md5OfBWImage(charImg);
20  
      L<S> meanings = md5ToChar.get(md5);
21  
      buf.append(empty(meanings) ? "?" : l(meanings) == 1 ? first(meanings) : "[" + join("|", meanings) + "]");
22  
    }
23  
    print(buf);
24  
  }
25  
}

Author comment

Began life as a copy of #1005845

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005950
Snippet name: Try auto-finding & recognizing characters
Eternal ID of this version: #1005950/1
Text MD5: e7fc498771ffaa230292488d850f2c7d
Transpilation MD5: 14f0194b5f4da221a2dbe46a64f65e4c
Author: stefan
Category: javax / ocr
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-13 04:17:16
Source code size: 736 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 513 / 603
Referenced in: [show references]