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)

AI > MemorizeArea {
  float similarityThreshold = 0.9f;
  int shrinkPixels = 1;
  RGBImage blobImage;
  static ImageSurface is;
  Pt lastLocation;

  void go {
    // guess
    
    Rect guess = null;
    if (blobImage != null) {
      guess = foundImgToRect(rgbRawImageSearch_searchHereFirst(image, blobImage, similarityThreshold, lastLocation));
      if (guess != null) lastLocation = new Pt(guess.x, guess.y);
    }

    // submit
    
    Rect solution = first(submit(guess));
    
    // learn
    
    if (blobImage == null && solution != null) {
      blobImage = image.clip(growRect(solution, -shrinkPixels));
      if (visualize)
        is = showZoomedImage(is, "Memorized Area", blobImage);
    }
  }
}

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