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

25
LINES

< > BotCompany Repo | #1009913 // Run Tesseract on Screenshot (assumes it's on PATH)

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

Download Jar. Libraryless. Click here for Pure Java version (3622L/26K).

!7

static bool use4dot0 = false;

p {
  S options = "-oem 4"; // Neural Network for "best" traineddata
    // "--tessdata-dir " + platformQuote(userHome("Downloads"));
  
  File tesseract = userHome("local/bin/tesseract");
  if (!fileExists(tesseract) || !use4dot0) {
    tesseract = findCmdOnPATH("tesseract");
    options = "";
  }
  if (tesseract == null) print("Tesseract not found on PATH");

  File png = getProgramFile("screen.png");
  print("Making screenshot.");
  hideConsole(); sleepSeconds(1);
  shootScreenAsPNGFile(png);
  showConsole();
  print("Running Tesseract.");
  time {
    print(backtick(print(platformQuote(tesseract) + " " + platformQuote(png) + " stdout" + " " + options)));
  }
}

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: #1009913
Snippet name: Run Tesseract on Screenshot (assumes it's on PATH)
Eternal ID of this version: #1009913/12
Text MD5: c17369dc5cad2e7761ae7385779eccfb
Transpilation MD5: 37b3f93b9f20bc4bb3b06e5591184e04
Author: stefan
Category: javax / ocr
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-25 20:31:06
Source code size: 731 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 445 / 952
Version history: 11 change(s)
Referenced in: [show references]