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

32
LINES

< > BotCompany Repo | #1006892 // MemorizeBrightBLOB (AI)

JavaX fragment (include)

1  
AI > MemorizeBrightBLOB {
2  
  RGBImage blobImage;
3  
  static ImageSurface is;
4  
5  
  static L<Rect> segment(RGBImage img) {
6  
    ret autoSegment_blackBG(new BWImage(img), 3); // 2 is too small
7  
  }
8  
9  
  void go {
10  
    // guess
11  
    
12  
    L<Rect> myRects = segment(image);
13  
    Rect guess = null;
14  
    if (blobImage != null)
15  
      guess = rgbFindMostSimilarClip(image, blobImage, myRects, 0);
16  
      
17  
    // submit
18  
    
19  
    Rect solution = first(submit(guess));
20  
    
21  
    // learn
22  
    
23  
    if (blobImage == null) {
24  
      solution = autoCropOfRGBImage_blackBG(image, solution);
25  
      Rect mine = smallestRectContaining(myRects, centerOfRect(solution));
26  
      if (mine != null) {
27  
        blobImage = image.clip(mine);
28  
        is = showZoomedImage(is, "Memorized BLOB", blobImage);
29  
      }
30  
    }
31  
  }
32  
}

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: #1006892
Snippet name: MemorizeBrightBLOB (AI)
Eternal ID of this version: #1006892/2
Text MD5: 9248020a0df7d26da9e4b3b673ec88a9
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-14 02:06:43
Source code size: 811 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 399 / 865
Version history: 1 change(s)
Referenced in: [show references]