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

25
LINES

< > BotCompany Repo | #1015457 // Recognize text on inverted screen [sometimes OK for Peppermint Terminal, but needs more contrast]

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

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (12805L/92K).

!7

static OCRRecognizeAndTeach ocr;

// contrast & brightness, roughly
//static float scaleFactor = 2f, offset = -130f;
static float scaleFactor = 2.1f, offset = -130f; // GOOD
//static float scaleFactor = 3f, offset = -130f;

p-subst-autorestart {
  ocr_recognizeMultiLine_scored_g = 2; // find cursor?
  //set ocr_recognizeMultiLine_scored_filterByMinScore; // don't show unrecognized things - but we want to teach so we want to see those too
  doIt();
  showButton("Again", r-thread { doIt() });
}

svoid doIt {
  cleanUp(ocr); ocr = null;
  print("Shooting & inverting");
  BufferedImage img = shootScreenHidingConsole();
  invertImage(img);
  bufferedImageContrastAndBrightness(img, scaleFactor, offset);
  saveJPG(img, getProgramFile("inverted-" + scaleFactor + "-" + offset + ".jpg"));
  ocr = new OCRRecognizeAndTeach(img);
}

Author comment

Began life as a copy of #1015456

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: #1015457
Snippet name: Recognize text on inverted screen [sometimes OK for Peppermint Terminal, but needs more contrast]
Eternal ID of this version: #1015457/22
Text MD5: c705209c705fa059332d7722a2c6b4c5
Transpilation MD5: cb7d5a12b8c7f0906c0652dff8dfc03d
Author: stefan
Category: javax / ocr
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-15 02:42:17
Source code size: 858 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 432 / 1220
Version history: 21 change(s)
Referenced in: [show references]