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

29
LINES

< > BotCompany Repo | #1015059 // Magic Wand Finder Demo [OK]

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

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

!7

sbool firstTime = true;
static int maxOriginalImageSize = 500;

p-experiment-tt {
  framesBot();
  centerFrameWithWidth(700, setFrameTitle(
    firstTime
      ? "Select picture of magic wand"
      : "There - I put the wand upright for you! Select another picture?", selectSnippetID_v1(#1101217, vf1(f go))));
  firstTime = false;
}

svoid go(S imageID) {
  Class recognizer = hotwire(#1015046);
  setMulti(recognizer, aiTitle := "Finding Wand...", thresholdRounds := 20000, showRepro := true);
  focusConsole();
  
  Pair<S, Double> p = cast quickImport(call(recognizer, 'imageToCode, imageID, 1));
  BackgroundPlus s = shallowCloneToClass(BackgroundPlus, unstruct(p.a));

  double angle = sortLineByY((LineWithColor) first(s.things)).angle();
  moveToTopCenter(showImage_centered("Wand facing up (or down)!", rotateImageInSameSize(
    scaleBufferedImageToMax(maxOriginalImageSize,
      (BufferedImage) get(recognizer, 'fullSizeImage)), 180-angle)));
  
  callMain(); // do it again
}

Author comment

Began life as a copy of #1015046

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: #1015059
Snippet name: Magic Wand Finder Demo [OK]
Eternal ID of this version: #1015059/20
Text MD5: 36c6374b7bfb66c9cadf17661a28ca87
Transpilation MD5: e4aac5a1e797559a722d44d17fa238f5
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-05-07 21:38:47
Source code size: 1022 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 559 / 3149
Version history: 19 change(s)
Referenced in: [show references]