1 | !7 |
2 | |
3 | RGB destColor = rgb("#E6ED2B"); |
4 | |
5 | p { |
6 | RGBImage img = shootScreen(); |
7 | |
8 | int w = img.getWidth(), h = img.getHeight(); |
9 | int overlap = 0; |
10 | float[] grid = new float[gw*gh]; |
11 | |
12 | for (int gy = 0; gy <= h- g; gy += g) |
13 | next: for (int gx = 0; gx <= w- g; gx += g) { |
14 | float min = 1, max = 0; |
15 | int y2 = min(h, gy + g + overlap); |
16 | int x2 = min(w, gx + g + overlap); |
17 | for (int y = gy; y < y2; y++) |
18 | for (int x = gx; x < x2; x++) { |
19 | float b = img.getPixel(x, y); |
20 | min = Math.min(min, b); |
21 | max = Math.max(max, b); |
22 | if (contrastMethod2 |
23 | ? max-min >= contrastThreshold |
24 | : min < brightnessThreshold && max > brightnessThreshold) { |
25 | grid[(gy / g) * gw + (gx / g)] = true; |
26 | continue next; |
27 | } |
28 | } |
29 | } |
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: | #1015464 |
Snippet name: | Find blue things on screen using grid [dev. 1] |
Eternal ID of this version: | #1015464/1 |
Text MD5: | c159d3e8653e4ddf0eec7c68f0faa9df |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-14 23:26:03 |
Source code size: | 842 bytes / 29 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 495 / 749 |
Referenced in: | [show references] |