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

31
LINES

< > BotCompany Repo | #1003959 // Run 411 Segmenter on Screen & Save Images Frantically

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

Uses 5262K of libraries. Click here for Pure Java version (1175L/8K/28K).

!752

import ai.d.ai17.*;

lib 1003956 // TinyBrain

p {
  new DesktopRecognizer rec;
  rec.setKeepScreenshot(true);
  S result;
  long time = now();
  result = rec.run411();
  done(time, "411");
  MultiMap<S, Rectangle> hashes = irParseHashes(result);
  printStructure(hashes);
  
  for (S hash : hashes.keySet()) {
    File file = getImgFile(hash);
    if (file.exists()) continue;
    L<Rectangle> rects = hashes.get(hash);
    Rectangle r = first(rects);
    BufferedImage clip = rec.getScreenshot().clip(r).getBufferedImage();
    savePNG(clip, file);
    print("Saved " + file.getAbsolutePath() + " (" + n(file.length(), "byte") + ")");
  }
  print("Hashes found: " + hashes.keySet().size());
}

static File getImgFile(S hash) {
  ret prepareProgramFile("images/" + hash + ".png");
}

Author comment

Began life as a copy of #1003954

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1003959
Snippet name: Run 411 Segmenter on Screen & Save Images Frantically
Eternal ID of this version: #1003959/1
Text MD5: 36530ac6a74271a55a7ddebd42bebc8b
Transpilation MD5: ccfb22b1f6b9e39895b9e69d4b5fbef4
Author: stefan
Category: javax / desktop recognition
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-07-31 18:49:11
Source code size: 819 bytes / 31 lines
Pitched / IR pitched: No / No
Views / Downloads: 559 / 594
Referenced in: [show references]