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

24
LINES

< > BotCompany Repo | #1015346 // getLearnedCharacters2 v1 (reads all clips)

JavaX fragment (include)

1  
static Map<S, BWImage> getLearnedCharacters2() {
2  
  new Matches m;
3  
  new HashSet<S> md5s;
4  
  for (S s : scanLog_iterator(glyphTeachLog()))
5  
    if (find3("the images *", afterSquareBracketStuff(s), m))
6  
      md5s.addAll(splitAtSpace($1));
7  
  //print("MD5s we're looking for: " + struct(md5s));
8  
  
9  
  new HashMap<S, BWImage> md5ToImage;
10  
  for (S md5, File f : screenClipFiles()) {
11  
    BWImage img = loadBWImage(f);
12  
    if (md5s.contains(md5))
13  
      md5ToImage.put(md5, img);
14  
    for (BWImage cImg : horizontalAutoSplitToImages(img)) {
15  
      S cMD5 = ocrMD5OfBWImage(cImg);
16  
      if (md5s.contains(cMD5))
17  
        md5ToImage.put(cMD5, cImg);
18  
    }
19  
  }
20  
  
21  
  int found = l(md5ToImage);
22  
  print("Found character images: " + found + "/" + l(md5s));
23  
  ret md5ToImage;
24  
}

Author comment

Began life as a copy of #1006193

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: #1015346
Snippet name: getLearnedCharacters2 v1 (reads all clips)
Eternal ID of this version: #1015346/1
Text MD5: f94e4d23480212cdc037afc9ac70695f
Author: stefan
Category: javax / ocr
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-13 12:31:17
Source code size: 779 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 378 / 381
Referenced in: [show references]