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

17
LINES

< > BotCompany Repo | #1027280 // bwImageSearch_onFound

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

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

svoid bwImageSearch_onFound(BWImage big, BWImage pat, float minSimilarity, IVF2<Rect, Double> onFound) {
  int wp = pat.getWidth(), hp = pat.getHeight();
  int w = big.getWidth(), h = big.getHeight();
  float maxError = (1f-minSimilarity)*wp*hp;
  bigloop: for (int y = 0; y < h-hp; y++)
    for (int x = 0; x < w-wp; x++) {
      float diff = bwImageSectionsSimilarity(big, pat, x, y, maxError);
      if (diff <= maxError) {
        maxError = diff;
        double sim = 1-diff/(wp*hp);
        Rect r = new Rect(x, y, wp, hp);
        onFound.get(r, sim);
        ping();
        //if (diff == 0) break bigloop;
      }
    }
}

Author comment

Began life as a copy of #1006412

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: #1027280
Snippet name: bwImageSearch_onFound
Eternal ID of this version: #1027280/3
Text MD5: 2e892a5a69a7ca81e5f54b7571011f3e
Transpilation MD5: 73fe3e3bc14579e6d8dcb05c549f39a0
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-29 16:01:44
Source code size: 646 bytes / 17 lines
Pitched / IR pitched: No / No
Views / Downloads: 127 / 190
Version history: 2 change(s)
Referenced in: [show references]