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

31
LINES

< > BotCompany Repo | #1005711 // Test horizontalAutoSplit + autoCrop

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (4142L/27K/92K).

1  
!752
2  
3  
static BWImage img;
4  
static ImageSurface is2;
5  
static float threshold = 0.99f; // for horizontalAutoSplit
6  
7  
p {
8  
  img = loadBWImage("#1005702");
9  
  update();
10  
}
11  
12  
svoid update() {
13  
  RGBImage vis = visualize().toRGB();
14  
  if (is2 == null) {
15  
    is2 = showZoomedImage(vis);
16  
    addToWindowAndPack(is2, liveSliderZeroToOne(threshold/10000f*9999f, voidfunc(float x) {
17  
      threshold = x*10000f/9999f;
18  
      update();
19  
    }));
20  
  } else
21  
    is2.setImage(vis);
22  
}
23  
24  
static BWImage visualize() {
25  
  BWImage im = new BWImage(img);
26  
  for (Rect r : horizontalAutoSplit(img, threshold)) {
27  
    r = autoCropOfBWImage(img, r);
28  
    darkenBWImagePart(im, r);
29  
  }
30  
  ret im;
31  
}

Author comment

Began life as a copy of #1005706

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1005711
Snippet name: Test horizontalAutoSplit + autoCrop
Eternal ID of this version: #1005711/1
Text MD5: 58c8dc171ddb86737d95f01a0500c8b6
Transpilation MD5: a04b2b178467681803c78420eafc9024
Author: stefan
Category: javax / ocr
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-04 20:32:51
Source code size: 684 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 427 / 465
Referenced in: [show references]