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

20
LINES

< > BotCompany Repo | #1015513 // ocr_terminalContents

JavaX fragment (include)

static S ocr_terminalContents() {
  new L<S> lines;
  
  BufferedImage img = shootScreen2();
  Rect r = ocr_findTerminalBackground(new RGBImage(img));
  if (r == null) null;
  final BufferedImage terminal = clipBufferedImage(img, r);
  ocr_terminalInvert1(terminal);
  LL<Rect> rects = ocr_makeTerminalGrid(terminal);
  BWImage bw = new BWImage(terminal);
  bw = bwAutoContrastAllRects(bw, concatLists(rects), 1f);
  for (L<Rect> row : rects) {
    L<S> chars = ocr_recognizeMultiLine(bw, row);
    new StringBuilder buf;
    for (S s : chars)
      buf.append(empty(s) ? " " : l(s) == 1 ? s : ocr_unknownCharacterPlaceholder());
    lines.add(str(buf));
  }
  ret lines(lines);
}

Author comment

Began life as a copy of #1015503

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: #1015513
Snippet name: ocr_terminalContents
Eternal ID of this version: #1015513/5
Text MD5: 442bed6b6c750dfed6bfb1aeb0b7def9
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-15 04:28:54
Source code size: 699 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 343 / 380
Version history: 4 change(s)
Referenced in: [show references]