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).

!7

static ScreenLens lens;
static volatile L<Rect> segments;
static BufferedImage imageForSegments;

p-substance {
  lens = new ScreenLens;
  lens.postProcess = func(BufferedImage img) {
    BWImage bw = bwImageTo2Bit(new BWImage(img), 0.5f);
    img = bw.getBufferedImage();
    segments = autoSegment(bw, 2);
    imageForSegments = img;
    drawBoxes(img, rectsToRectangles(segments), Color.red, 0.8f);
    ret img;
  };
  lens.start();
  makeBot("Screen Lens b/w.");
}

static S answer(S s) {
  new Matches m;
  if "segments" ret structure(segments);
  
  // get both in a synchronized manner
  if "image and segments" {
    L<Rect> segments = main.segments;
    RGBImage image = new RGBImage(imageForSegments);
    ret structure(ll(image, segments));
  }
  
  ret lens.answer(s);
}

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: 604 / 748
Referenced in: [show references]