!7 RGB destColor = rgb("#E6ED2B"); p { RGBImage img = shootScreen(); int w = img.getWidth(), h = img.getHeight(); int overlap = 0; float[] grid = new float[gw*gh]; for (int gy = 0; gy <= h- g; gy += g) next: for (int gx = 0; gx <= w- g; gx += g) { float min = 1, max = 0; int y2 = min(h, gy + g + overlap); int x2 = min(w, gx + g + overlap); for (int y = gy; y < y2; y++) for (int x = gx; x < x2; x++) { float b = img.getPixel(x, y); min = Math.min(min, b); max = Math.max(max, b); if (contrastMethod2 ? max-min >= contrastThreshold : min < brightnessThreshold && max > brightnessThreshold) { grid[(gy / g) * gw + (gx / g)] = true; continue next; } } }
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: | 494 / 748 |
Referenced in: | [show references] |