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

29
LINES

< > BotCompany Repo | #1018585 // Two Magic Wands Finder Demo [OK]

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

Download Jar. Libraryless. Click here for Pure Java version (12234L/90K).

!7

sbool firstTime = true;
static int maxOriginalImageSize = 500;

p-experiment-tt {
  framesBot();
  centerFrameWithWidth(700, setFrameTitle(
    firstTime
      ? "Select picture of 2 magic wands"
      : "There - I put one of the wands 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, 2));
  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 #1015059

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1018585
Snippet name: Two Magic Wands Finder Demo [OK]
Eternal ID of this version: #1018585/3
Text MD5: 1e838b958737b64b3926df70b221f4b4
Transpilation MD5: 97d0a1da7cdda05f65316f808e7c6783
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-10-06 19:14:33
Source code size: 1033 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 365 / 837
Version history: 2 change(s)
Referenced in: [show references]