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

11
LINES

< > BotCompany Repo | #1027320 // bwImageSectionsSimilarity2_partial - returns similarity (not difference). looks at a part of the pattern

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5108L/33K).

// works in similarity
static float bwImageSectionsSimilarity2_partial(BWImage big, BWImage pat, int x, int y, int px1, int py1, int wp, int hp, float similarity) {
  float maxError = (1f-similarity)*wp*hp;
  float diff = 0;
  for yy to hp:
    for xx to wp: {
      diff += Math.abs(big.getPixel(x+xx, y+yy)-pat.getPixel(px1+xx, py1+yy));
      if (diff > maxError) ret similarity-0.001f;
    }
  ret 1f-diff/wp/hp;
}

Author comment

Began life as a copy of #1005919

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1027320
Snippet name: bwImageSectionsSimilarity2_partial - returns similarity (not difference). looks at a part of the pattern
Eternal ID of this version: #1027320/3
Text MD5: 2c125bd1ee59aefe70bed487cc6b6e6d
Transpilation MD5: cea26e9bcd8e81c8f6be2bfd4e9000e5
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-04 15:47:46
Source code size: 428 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 181 / 278
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)