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

!752

p {
  BWImage img = shootScreenBW();
  
  Class loader = hotwire("#1005947");
  call(loader, "getData");
  Map<S, L<S>> md5ToChar = (Map) get(get(loader, "md5ToChar"), "data");
  
  int g = 3;
  L<Rect> clips = autoSegment(img, g);
  new L<Rect> chars;
  for (Rect r : clips) {
    new StringBuffer buf;
    BWImage lineImg = img.clip(r);
    for (Rect c : horizontalAutoSplit2ThenAutoCrop(lineImg)) {
      chars.add(translateRect(c, r.x, r.y));
      BWImage charImg = lineImg.clip(c);
      S md5 = md5OfBWImage(charImg);
      L<S> meanings = md5ToChar.get(md5);
      buf.append(empty(meanings) ? "?" : l(meanings) == 1 ? first(meanings) : "[" + join("|", meanings) + "]");
    }
    print(buf);
  }
}

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: 511 / 601
Referenced in: [show references]