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

18
LINES

< > BotCompany Repo | #1022979 // bwImageSearch_best_virtualBig - return best match

JavaX fragment (include)

static FoundImg bwImageSearch_best_virtualBig(IBWImage big, BWImage pat, float similarity) {
  new Best<Rect> best;
  int wp = pat.getWidth(), hp = pat.getHeight();
  int w = big.getWidth(), h = big.getHeight();
  float maxError = (1f-similarity)*wp*hp;
  bigloop: for (int y = 0; y < h-hp; y++)
    for (int x = 0; x < w-wp; x++) {
      float diff = bwImageSectionsSimilarity_firstVirtual(big, pat, x, y, maxError);
      if (diff <= maxError && best.isNewBest(-diff)) {
        maxError = diff;
        Rect r = new Rect(x, y, wp, hp);
        best.put(r, -diff);
        ping();
        if (diff == 0) break bigloop;
      }
    }
  ret !best.has() ? null : new FoundImg(best!, 1-(-(float) best.bestScore())/(wp*hp));
}

Author comment

Began life as a copy of #1006412

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: #1022979
Snippet name: bwImageSearch_best_virtualBig - return best match
Eternal ID of this version: #1022979/3
Text MD5: 8d2b576b6045ec9d251ef3c3adaead91
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:17
Source code size: 740 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 210 / 274
Version history: 2 change(s)
Referenced in: [show references]