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

29
LINES

< > BotCompany Repo | #1006912 // MemorizeArea (AI) - with similarity threshold + optimization for application

JavaX fragment (include)

1  
AI > MemorizeArea {
2  
  float similarityThreshold = 0.9f;
3  
  int shrinkPixels = 1;
4  
  RGBImage blobImage;
5  
  static ImageSurface is;
6  
  Pt lastLocation;
7  
8  
  void go {
9  
    // guess
10  
    
11  
    Rect guess = null;
12  
    if (blobImage != null) {
13  
      guess = foundImgToRect(rgbRawImageSearch_searchHereFirst(image, blobImage, similarityThreshold, lastLocation));
14  
      if (guess != null) lastLocation = new Pt(guess.x, guess.y);
15  
    }
16  
17  
    // submit
18  
    
19  
    Rect solution = first(submit(guess));
20  
    
21  
    // learn
22  
    
23  
    if (blobImage == null && solution != null) {
24  
      blobImage = image.clip(growRect(solution, -shrinkPixels));
25  
      if (visualize)
26  
        is = showZoomedImage(is, "Memorized Area", blobImage);
27  
    }
28  
  }
29  
}

Author comment

Began life as a copy of #1006905

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006912
Snippet name: MemorizeArea (AI) - with similarity threshold + optimization for application
Eternal ID of this version: #1006912/8
Text MD5: f194a0de420edb61d51227debbae0096
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-15 05:57:15
Source code size: 744 bytes / 29 lines
Pitched / IR pitched: No / No
Views / Downloads: 413 / 943
Version history: 7 change(s)
Referenced in: [show references]