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

12
LINES

< > BotCompany Repo | #1005394 // bwImageSectionsSimilarity

JavaX fragment (include)

// returns diff (not similarity)
static float bwImageSectionsSimilarity(BWImage big, BWImage pat, int x, int y, float max) {
  int wp = pat.getWidth(), hp = pat.getHeight();
  int w = big.getWidth(), h = big.getHeight();
  float diff = 0;
  for (int yy = 0; yy < hp; yy++)
    for (int xx = 0; xx < wp; xx++) {
      diff += Math.abs(big.getPixel(x+xx, y+yy)-pat.getPixel(xx, yy));
      if (diff > max) ret max+1;
    }
  ret diff;
}

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: 668 / 617
Referenced in: #1005753 - bwImagesSimilar
#1005919 - bwImageSectionsSimilarity2 - returns similarity (not difference)
#1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1006803 - rgbImageSectionsSimilarity
#1022983 - bwImageSectionsSimilarity_firstVirtual