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

20
LINES

< > BotCompany Repo | #1005893 // bwRawImageSearch_quick

JavaX fragment (include)

1  
// similarity = e.g. 0.99f
2  
static L<FoundImg> bwRawImageSearch_quick(BWImage big, BWImage pat, float similarity, int maxEntries) {
3  
  new L<FoundImg> found;
4  
  int wp = pat.getWidth(), hp = pat.getHeight();
5  
  int w = big.getWidth(), h = big.getHeight();
6  
  float maxError = (1f-similarity)*wp*hp;
7  
  for (int y = 0; y < h-hp; y++)
8  
    for (int x = 0; x < w-wp; x++) {
9  
      float diff = bwImageSectionsSimilarity(big, pat, x, y, maxError);
10  
      if (diff <= maxError) {
11  
        float sim = 1-diff/(wp*hp);
12  
        Rect r = new Rect(x, y, wp, hp);
13  
        found.add(new FoundImg(r, sim));
14  
        ping();
15  
        if (l(found) >= maxEntries) ret found;
16  
        x += wp-1;
17  
      }
18  
    }
19  
  ret found;
20  
}

Author comment

Began life as a copy of #1005396

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005893
Snippet name: bwRawImageSearch_quick
Eternal ID of this version: #1005893/1
Text MD5: 19dd35b274f3a5bb720b45aca257ff3d
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-12 14:32:11
Source code size: 713 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 533 / 543
Referenced in: [show references]