1 | static FoundImg rgbImageSearch_best(RGBImage big, RGBImage pat, float similarity) { |
2 | new Best<Rect> best; |
3 | int wp = pat.getWidth(), hp = pat.getHeight(); |
4 | int w = big.getWidth(), h = big.getHeight(); |
5 | float maxError = (1f-similarity)*wp*hp; |
6 | bigloop: for (int y = 0; y < h-hp; y++) |
7 | for (int x = 0; x < w-wp; x++) { |
8 | float diff = rgbImageSectionsSimilarity(big, pat, x, y, maxError); |
9 | if (diff <= maxError && best.isNewBest(-diff)) { |
10 | maxError = diff; |
11 | Rect r = new Rect(x, y, wp, hp); |
12 | best.put(r, -diff); |
13 | ping(); |
14 | if (diff == 0) break bigloop; |
15 | } |
16 | } |
17 | Rect r = best.get(); |
18 | ret r == null ? null : new FoundImg(r, 1-(-(float) best.bestScore())/(wp*hp)); |
19 | } |
Began life as a copy of #1006412
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019535 |
Snippet name: | rgbImageSearch_best - return best match |
Eternal ID of this version: | #1019535/1 |
Text MD5: | 42a1467f882654ca07d38dba1ce38ab1 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-11-11 20:30:33 |
Source code size: | 737 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 263 / 303 |
Referenced in: | [show references] |