1 | static float rgbLocalSimilarity(RGBImage img, Rect r1, Rect r2) { |
2 | int w = r1.w, h = r1.h; |
3 | if (w != r2.w || h != r2.h) ret 0; |
4 | float diff = 0; |
5 | for y to h: for x to w: |
6 | diff += rgbDiff(img.getInt(r1.x+x, r1.y+y), img.getInt(r2.x+x, r2.y+y)); |
7 | ret 1f-diff/(w*h); |
8 | } |
Began life as a copy of #1006805
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: | #1006806 |
Snippet name: | rgbLocalSimilarity |
Eternal ID of this version: | #1006806/3 |
Text MD5: | 74f77addd3f9352e9603fcb3917a9d6a |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-02-05 02:50:15 |
Source code size: | 279 bytes / 8 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 578 / 583 |
Version history: | 2 change(s) |
Referenced in: | [show references] |