Libraryless. Click here for Pure Java version (5825L/38K/126K).
1 | !752 |
2 | |
3 | static class MyComparator implements BWImageSectionComparator { |
4 | int step = 5; |
5 | public float compare(BWImage big, BWImage pat, int x, int y, float max) { |
6 | int wp = pat.getWidth(), hp = pat.getHeight(); |
7 | int w = big.getWidth(), h = big.getHeight(); |
8 | float diff = 0; |
9 | final int _step = step; |
10 | for sx to _step: |
11 | for sy to _step: |
12 | for (int xx = sx; xx < wp; xx += _step) |
13 | for (int yy = sy; yy < hp; yy += _step) { |
14 | diff += abs(big.getPixel(x+xx, y+yy)-pat.getPixel(xx, yy)); |
15 | if (diff > max) ret max+1; |
16 | } |
17 | ret diff; |
18 | } |
19 | } |
20 | |
21 | concepts. |
22 | |
23 | !include #1005393 // Marked Screenshot Classes |
24 | |
25 | p { |
26 | bwRawImageSearch_comparator = new MyComparator; |
27 | BWImage screen = shootScreenBW(); |
28 | loadConceptsFrom("#1005389"); |
29 | float similarity = 0.999f; |
30 | long start = now(); |
31 | for (MarkedClip clip) time { |
32 | print("Searching: " + clip.description + "..."); |
33 | bwRawImageSearch_verbose = true; |
34 | bwRawImageSearch(screen, clip.img, similarity); |
35 | } |
36 | done(start, "Total for " + n(countConcepts(MarkedClip), "images")); |
37 | } |
Began life as a copy of #1005395
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005442 |
Snippet name: | Test alternative image comparator |
Eternal ID of this version: | #1005442/1 |
Text MD5: | 99b29c3c16f054897e6e76d88564cd1c |
Transpilation MD5: | 919946cc520f7f624a2d04e455f4a716 |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-11-18 18:50:17 |
Source code size: | 1116 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 479 / 600 |
Referenced in: | [show references] |