1 | // returns diff (not similarity), not divided by pixel number (same for maxError) |
2 | static float rgbImageSectionsSimilarity(RGBImage big, RGBImage pat, int x, int y, float maxError) {
|
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 += rgbDiff(big.getInt(x+xx, y+yy), pat.getInt(xx, yy)); |
9 | if (diff > maxError) ret maxError+1; |
10 | } |
11 | ret diff; |
12 | } |
Began life as a copy of #1005394
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: | #1006803 |
| Snippet name: | rgbImageSectionsSimilarity |
| Eternal ID of this version: | #1006803/2 |
| Text MD5: | 681e6047b537faf572b3736a048eefaf |
| Author: | stefan |
| Category: | javax / imaging |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-02-09 00:50:26 |
| Source code size: | 508 bytes / 12 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 704 / 738 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |