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

16
LINES

< > BotCompany Repo | #1018787 // findBrightHorizontalStreaks

JavaX fragment (include)

1  
static L<IntRange> findBrightHorizontalStreaks(BWImage img) {
2  
  ret findBrightHorizontalStreaks(img, 0.5f);
3  
}
4  
5  
static L<IntRange> findBrightHorizontalStreaks(BWImage img, float threshold) {
6  
  new L<IntRange> out;
7  
  int i = 0, n = img.getWidth();
8  
  while (i < n) {
9  
    int j = i;
10  
    while (j < n && img.getPixel(j, 0) >= threshold) ++j;
11  
    if (j > i)
12  
      out.add(intRange(i, j));
13  
    i = j+1;
14  
  }
15  
  ret out;
16  
}

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: 334 / 364
Version history: 2 change(s)
Referenced in: [show references]