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

30
LINES

< > BotCompany Repo | #1022990 // BWII_MultiPatternFinder [needs auto-contrast for real-life images]

JavaX fragment (include)

1  
sclass BWII_MultiPatternFinder implements Iterable<FoundImg> {
2  
  new L<BWImage> patternImages;
3  
  L<Int> scaleWidths = ll(25, 35, 50, 75, 100); // widths to scale input image to
4  
  
5  
  transient BWIntegralImage ii;
6  
  transient IBWImage scaled;
7  
  transient BWImage pattern;
8  
  transient FoundImg found;
9  
  transient int currentScaleWidth;
10  
  
11  
  *() {}
12  
  *(L<BWImage> *patternImages, BWIntegralImage *ii) {}
13  
  
14  
  // only call once
15  
  public Iterator<FoundImg> iterator() {
16  
    ret nonNullIterator(nestedIterator(scaleWidths, func(int scaleWidth) -> Iterator<FoundImg> {
17  
      currentScaleWidth = scaleWidth;
18  
      ret mapI(patternImages, func(BWImage pat) {
19  
        pattern = pat;
20  
        FoundImg lastFound = found;
21  
        if (scaled == null || scaled.getWidth() != scaleWidth)
22  
          scaled = virtualScaledIntegralImageBW(ii, scaleWidth);
23  
        FoundImg found2 = bwImageSearch_best_virtualBig(scaled, pat, found == null ? 0f : found.sim);
24  
        if (found2 != null)
25  
          ret found = found2;
26  
        null;
27  
      });
28  
    }));
29  
  }
30  
}

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: #1022990
Snippet name: BWII_MultiPatternFinder [needs auto-contrast for real-life images]
Eternal ID of this version: #1022990/14
Text MD5: d6209dff078b69063616c59e5bd4b843
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-17 22:49:19
Source code size: 1063 bytes / 30 lines
Pitched / IR pitched: No / No
Views / Downloads: 295 / 737
Version history: 13 change(s)
Referenced in: [show references]