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

1  
!7
2  
3  
sbool firstTime = true;
4  
static int maxOriginalImageSize = 500;
5  
6  
p-experiment-tt {
7  
  framesBot();
8  
  centerFrameWithWidth(700, setFrameTitle(
9  
    firstTime
10  
      ? "Select picture of 2 magic wands"
11  
      : "There - I put one of the wands upright for you! Select another picture?", selectSnippetID_v1(#1101217, vf1(f go))));
12  
  firstTime = false;
13  
}
14  
15  
svoid go(S imageID) {
16  
  Class recognizer = hotwire(#1015046);
17  
  setMulti(recognizer, aiTitle := "Finding Wand...", thresholdRounds := 20000, showRepro := true);
18  
  focusConsole();
19  
  
20  
  Pair<S, Double> p = cast quickImport(call(recognizer, 'imageToCode, imageID, 2));
21  
  BackgroundPlus s = shallowCloneToClass(BackgroundPlus, unstruct(p.a));
22  
23  
  double angle = sortLineByY((LineWithColor) first(s.things)).angle();
24  
  moveToTopCenter(showImage_centered("Wand facing up (or down)!", rotateImageInSameSize(
25  
    scaleBufferedImageToMax(maxOriginalImageSize,
26  
      (BufferedImage) get(recognizer, 'fullSizeImage)), 180-angle)));
27  
  
28  
  callMain(); // do it again
29  
}

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: 367 / 841
Version history: 2 change(s)
Referenced in: [show references]