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

12
LINES

< > BotCompany Repo | #1022983 // bwImageSectionsSimilarity_firstVirtual

JavaX fragment (include)

// returns diff (not similarity)
static float bwImageSectionsSimilarity_firstVirtual(IBWImage 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.getFloatPixel(x+xx, y+yy)-pat.getPixel(xx, yy));
      if (diff > max) ret max+1;
    }
  ret diff;
}

Author comment

Began life as a copy of #1005394

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022983
Snippet name: bwImageSectionsSimilarity_firstVirtual
Eternal ID of this version: #1022983/1
Text MD5: 62a95fdd97a2fa7c12204a139b975ec4
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-17 08:21:00
Source code size: 464 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 270 / 308
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)