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

18
LINES

< > BotCompany Repo | #1006388 // ocr_vsplit

JavaX fragment (include)

1  
static L<Rect> ocr_vsplit(RGBImage img, bool[] split) {
2  
  int w = img.w(), h = img.h();
3  
  int y1 = 0, y = 0;
4  
  new L<Rect> l;
5  
  while (y < h) {
6  
    while (y < h && split[y]) y++;
7  
    if (y > y1) {
8  
      l.add(new Rect(0, y1, w, y-y1));
9  
      y1 = y;
10  
    }
11  
    while (y < h && !split[y]) y++;
12  
    if (y > y1) {
13  
      l.add(new Rect(0, y1, w, y-y1));
14  
      y1 = y;
15  
    }
16  
  }
17  
  ret l;
18  
}

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: #1006388
Snippet name: ocr_vsplit
Eternal ID of this version: #1006388/1
Text MD5: 3508634ef85cfcedd8e16f38acf5986e
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-29 23:49:54
Source code size: 400 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 473 / 490
Referenced in: [show references]