1 | static int autoShoot_maxW = 500, autoShoot_maxH = 200; |
2 | |
3 | sclass AutoShootInfo {
|
4 | long screenshotTime; |
5 | L<Rect> segments; |
6 | int considered; |
7 | } |
8 | |
9 | static AutoShootInfo autoShoot() {
|
10 | ret autoShoot(f shootScreenBW); |
11 | } |
12 | |
13 | static AutoShootInfo autoShoot(O shootFunc) {
|
14 | new AutoShootInfo info; |
15 | info.screenshotTime = now(); |
16 | BWImage screen = cast callF(shootFunc); |
17 | info.segments = autoSegment(screen); |
18 | for (Rect r : info.segments) {
|
19 | if (r.w > autoShoot_maxW || r.h > autoShoot_maxH) continue; |
20 | ++info.considered; |
21 | BWImage image = screen.clip(r); |
22 | S md5 = md5OfBWImage(image); |
23 | GrabbedImage gi = uniq(GrabbedImage, +md5); |
24 | if (gi.image == null) cset(gi, +image); |
25 | cset(gi, |
26 | lastRect := r, |
27 | lastScreenshotTime := info.screenshotTime, |
28 | count := gi.count+1); |
29 | } |
30 | ret info; |
31 | } |
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: | 745 / 807 |
| Referenced in: | [show references] |