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

1  
!7
2  
3  
static OCRRecognizeAndTeach ocr;
4  
5  
// contrast & brightness, roughly
6  
//static float scaleFactor = 2f, offset = -130f;
7  
static float scaleFactor = 2.1f, offset = -130f; // GOOD
8  
//static float scaleFactor = 3f, offset = -130f;
9  
10  
p-subst-autorestart {
11  
  ocr_recognizeMultiLine_scored_g = 2; // find cursor?
12  
  //set ocr_recognizeMultiLine_scored_filterByMinScore; // don't show unrecognized things - but we want to teach so we want to see those too
13  
  doIt();
14  
  showButton("Again", r-thread { doIt() });
15  
}
16  
17  
svoid doIt {
18  
  cleanUp(ocr); ocr = null;
19  
  print("Shooting & inverting");
20  
  BufferedImage img = shootScreenHidingConsole();
21  
  invertImage(img);
22  
  bufferedImageContrastAndBrightness(img, scaleFactor, offset);
23  
  saveJPG(img, getProgramFile("inverted-" + scaleFactor + "-" + offset + ".jpg"));
24  
  ocr = new OCRRecognizeAndTeach(img);
25  
}

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: 542 / 1534
Version history: 21 change(s)
Referenced in: [show references]