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

15
LINES

< > BotCompany Repo | #1027281 // bwImageSearch_onFound_allCandidates

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

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

1  
svoid bwImageSearch_onFound_allCandidates(BWImage big, BWImage pat, float minSimilarity, IVF2<Rect, Double> onFound) {
2  
  int wp = pat.getWidth(), hp = pat.getHeight();
3  
  int w = big.getWidth(), h = big.getHeight();
4  
  float maxError = (1f-minSimilarity)*wp*hp;
5  
  bigloop: for (int y = 0; y < h-hp; y++)
6  
    for (int x = 0; x < w-wp; x++) {
7  
      float diff = bwImageSectionsSimilarity(big, pat, x, y, maxError);
8  
      if (diff <= maxError) {
9  
        double sim = 1-diff/(wp*hp);
10  
        Rect r = new Rect(x, y, wp, hp);
11  
        onFound.get(r, sim);
12  
        ping();
13  
      }
14  
    }
15  
}

Author comment

Began life as a copy of #1027280

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: #1027281
Snippet name: bwImageSearch_onFound_allCandidates
Eternal ID of this version: #1027281/1
Text MD5: ed2e8034cfade794c9241087e35c8b9c
Transpilation MD5: 1b138f5c0c3fdbc0e1cb4f61eda8c37c
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:14:26
Source code size: 593 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 181 / 260
Referenced in: [show references]