Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

8
LINES

< > BotCompany Repo | #1006806 // rgbLocalSimilarity

JavaX fragment (include)

static float rgbLocalSimilarity(RGBImage img, Rect r1, Rect r2) {
  int w = r1.w, h = r1.h;
  if (w != r2.w || h != r2.h) ret 0;
  float diff = 0;
  for y to h: for x to w:
    diff += rgbDiff(img.getInt(r1.x+x, r1.y+y), img.getInt(r2.x+x, r2.y+y));
  ret 1f-diff/(w*h);
}

Author comment

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: 577 / 582
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)