static float bwImagesSimilar_similarity = 0.99f; static bool bwImagesSimilar(BWImage big, BWImage pat) { ret bwImagesSimilar(big, pat, bwImagesSimilar_similarity); } static bool bwImagesSimilar(BWImage big, BWImage pat, float similarity) { int wp = pat.getWidth(), hp = pat.getHeight(); int w = big.getWidth(), h = big.getHeight(); if (wp != w || hp != h) false; float max = (1f-similarity)*wp*hp; float diff = 0; for (int yy = 0; yy < hp; yy++) for (int xx = 0; xx < wp; xx++) { diff += Math.abs(big.getPixel(xx, yy)-pat.getPixel(xx, yy)); if (diff > max) false; } true; }
Began life as a copy of #1005394
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: | #1005753 |
Snippet name: | bwImagesSimilar |
Eternal ID of this version: | #1005753/1 |
Text MD5: | 9c2b848ecedeb8a283defe4ddcdacffb |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-12-09 01:45:45 |
Source code size: | 629 bytes / 19 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 638 / 649 |
Referenced in: | [show references] |