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)

sclass BWII_MultiPatternFinder implements Iterable<FoundImg> {
  new L<BWImage> patternImages;
  L<Int> scaleWidths = ll(25, 35, 50, 75, 100); // widths to scale input image to
  
  transient BWIntegralImage ii;
  transient IBWImage scaled;
  transient BWImage pattern;
  transient FoundImg found;
  transient int currentScaleWidth;
  
  *() {}
  *(L<BWImage> *patternImages, BWIntegralImage *ii) {}
  
  // only call once
  public Iterator<FoundImg> iterator() {
    ret nonNullIterator(nestedIterator(scaleWidths, func(int scaleWidth) -> Iterator<FoundImg> {
      currentScaleWidth = scaleWidth;
      ret mapI(patternImages, func(BWImage pat) {
        pattern = pat;
        FoundImg lastFound = found;
        if (scaled == null || scaled.getWidth() != scaleWidth)
          scaled = virtualScaledIntegralImageBW(ii, scaleWidth);
        FoundImg found2 = bwImageSearch_best_virtualBig(scaled, pat, found == null ? 0f : found.sim);
        if (found2 != null)
          ret found = found2;
        null;
      });
    }));
  }
}

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: 224 / 660
Version history: 13 change(s)
Referenced in: [show references]