static Set<S> thingsOnScreenMap_md5s; static File thingsOnScreenMap_cacheFile() { ret newFile(javaxCacheDir(), "segments-on-screen.txt"); } static MultiMap<S, Rect> thingsOnScreenMap() { lock thingsOnScreenMap_lock; pcall { S s = loadTextFile(thingsOnScreenMap_cacheFile()); if (s != null) { long time = parseLong(first(lines(s))); if (now() < time+10000) ret thin } ret thingsOnScreenMap(shootScreenBW()); } static MultiMap<S, Rect> thingsOnScreenMap(BWImage bwScreenShot) { new TreeSet<S> elements; L<Rect> segments = autoSegment(bwScreenShot); new MultiMap<S, Rect> map; new HashSet<S> md5s; for (Rect r : segments) { RGBImage clip = bwScreenShot.clip(r).toRGB(); md5s.add(rgbMD5(clip)); } thingsOnScreenMap_md5s = md5s; ret md5sOnScreenToNames(md5s); SS comments = thingsOnScreenDefinitions(); S text = comments.get(md5); if (nempty(text)) map.put(text, r); } ret map; }
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: | #1015117 |
Snippet name: | Modifying thingsOnScreenMap [dev.] |
Eternal ID of this version: | #1015117/1 |
Text MD5: | 76f7488548f09fbdbc573f2d6cfc0c73 |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-08 14:47:45 |
Source code size: | 987 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 313 / 349 |
Referenced in: | [show references] |