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

12
LINES

< > BotCompany Repo | #1022983 // bwImageSectionsSimilarity_firstVirtual

JavaX fragment (include)

1  
// returns diff (not similarity)
2  
static float bwImageSectionsSimilarity_firstVirtual(IBWImage big, BWImage pat, int x, int y, float max) {
3  
  int wp = pat.getWidth(), hp = pat.getHeight();
4  
  int w = big.getWidth(), h = big.getHeight();
5  
  float diff = 0;
6  
  for (int yy = 0; yy < hp; yy++)
7  
    for (int xx = 0; xx < wp; xx++) {
8  
      diff += Math.abs(big.getFloatPixel(x+xx, y+yy)-pat.getPixel(xx, yy));
9  
      if (diff > max) ret max+1;
10  
    }
11  
  ret diff;
12  
}

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: 269 / 308
Referenced in: [show references]