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

12
LINES

< > BotCompany Repo | #1006803 // rgbImageSectionsSimilarity

JavaX fragment (include)

// returns diff (not similarity), not divided by pixel number (same for maxError)
static float rgbImageSectionsSimilarity(RGBImage big, RGBImage pat, int x, int y, float maxError) {
  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 += rgbDiff(big.getInt(x+xx, y+yy), pat.getInt(xx, yy));
      if (diff > maxError) ret maxError+1;
    }
  ret diff;
}

Author comment

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