static int autoShoot_maxW = 500, autoShoot_maxH = 200; sclass AutoShootInfo { long screenshotTime; L<Rect> segments; int considered; } static AutoShootInfo autoShoot() { ret autoShoot(f shootScreenBW); } static AutoShootInfo autoShoot(O shootFunc) { new AutoShootInfo info; info.screenshotTime = now(); BWImage screen = cast callF(shootFunc); info.segments = autoSegment(screen); for (Rect r : info.segments) { if (r.w > autoShoot_maxW || r.h > autoShoot_maxH) continue; ++info.considered; BWImage image = screen.clip(r); S md5 = md5OfBWImage(image); GrabbedImage gi = uniq(GrabbedImage, +md5); if (gi.image == null) cset(gi, +image); cset(gi, lastRect := r, lastScreenshotTime := info.screenshotTime, count := gi.count+1); } ret info; }
Began life as a copy of #1005951
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: | #1006119 |
Snippet name: | autoShoot + AutoShootInfo |
Eternal ID of this version: | #1006119/1 |
Text MD5: | 6097c5da922370ef7ae553d6e9a29587 |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-20 15:58:19 |
Source code size: | 840 bytes / 31 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 523 / 570 |
Referenced in: | [show references] |