1 | // returns diff (not similarity) |
2 | static float bwImageSectionsSimilarity(BWImage big, BWImage pat, int x, int y, float max) { |
3 | int wp = pat.getWidth(), hp = pat.getHeight(); |
4 | int w = big.getWidth(), h = big.getHeight(); |
5 | float diff = 0; |
6 | for (int yy = 0; yy < hp; yy++) |
7 | for (int xx = 0; xx < wp; xx++) { |
8 | diff += Math.abs(big.getPixel(x+xx, y+yy)-pat.getPixel(xx, yy)); |
9 | if (diff > max) ret max+1; |
10 | } |
11 | ret diff; |
12 | } |
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: | #1005394 |
Snippet name: | bwImageSectionsSimilarity |
Eternal ID of this version: | #1005394/1 |
Text MD5: | af95cfd22fa643dd09e8435c3448a84c |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-12 18:34:38 |
Source code size: | 445 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 669 / 619 |
Referenced in: | [show references] |