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

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 magic wand"
11  
      : "There - I put the wand 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, 1));
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 #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: 581 / 3208
Version history: 19 change(s)
Referenced in: [show references]