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

16
LINES

< > BotCompany Repo | #1018787 // findBrightHorizontalStreaks

JavaX fragment (include)

static L<IntRange> findBrightHorizontalStreaks(BWImage img) {
  ret findBrightHorizontalStreaks(img, 0.5f);
}

static L<IntRange> findBrightHorizontalStreaks(BWImage img, float threshold) {
  new L<IntRange> out;
  int i = 0, n = img.getWidth();
  while (i < n) {
    int j = i;
    while (j < n && img.getPixel(j, 0) >= threshold) ++j;
    if (j > i)
      out.add(intRange(i, j));
    i = j+1;
  }
  ret out;
}

Author comment

Began life as a copy of #1008769

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1018787
Snippet name: findBrightHorizontalStreaks
Eternal ID of this version: #1018787/3
Text MD5: 096239a243a26b05f56531b07b386f37
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-14 12:53:36
Source code size: 427 bytes / 16 lines
Pitched / IR pitched: No / No
Views / Downloads: 333 / 363
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)