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

33
LINES

< > BotCompany Repo | #1006558 // Screen Lens with standard b/w conversion & export

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

Uses 3874K of libraries. Click here for Pure Java version (8338L/59K/197K).

1  
!7
2  
3  
static ScreenLens lens;
4  
static volatile L<Rect> segments;
5  
static BufferedImage imageForSegments;
6  
7  
p-substance {
8  
  lens = new ScreenLens;
9  
  lens.postProcess = func(BufferedImage img) {
10  
    BWImage bw = bwImageTo2Bit(new BWImage(img), 0.5f);
11  
    img = bw.getBufferedImage();
12  
    segments = autoSegment(bw, 2);
13  
    imageForSegments = img;
14  
    drawBoxes(img, rectsToRectangles(segments), Color.red, 0.8f);
15  
    ret img;
16  
  };
17  
  lens.start();
18  
  makeBot("Screen Lens b/w.");
19  
}
20  
21  
static S answer(S s) {
22  
  new Matches m;
23  
  if "segments" ret structure(segments);
24  
  
25  
  // get both in a synchronized manner
26  
  if "image and segments" {
27  
    L<Rect> segments = main.segments;
28  
    RGBImage image = new RGBImage(imageForSegments);
29  
    ret structure(ll(image, segments));
30  
  }
31  
  
32  
  ret lens.answer(s);
33  
}

Author comment

Began life as a copy of #1006550

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006558
Snippet name: Screen Lens with standard b/w conversion & export
Eternal ID of this version: #1006558/1
Text MD5: 1d5d1d09711249b166189d041950a3d2
Transpilation MD5: 7a1689f97893aa9d9fc0c9808741297e
Author: stefan
Category: javax / gui / ocr
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-24 11:12:24
Source code size: 818 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 606 / 751
Referenced in: [show references]