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

32
LINES

< > BotCompany Repo | #1007106 // MemorizeBrightBLOB3 (AI) - multiple images

JavaX fragment (include)

1  
AI > MemorizeBrightBLOB3 {
2  
  float similarityThreshold = 0.9f;
3  
  new L<RGBImage> images;
4  
  static ImageSurface is;
5  
6  
  static L<Rect> segment(RGBImage img) {
7  
    ret autoSegment_blackBG(new BWImage(img), 3); // 2 is too small
8  
  }
9  
10  
  void go {
11  
    // guess
12  
    
13  
    L<Rect> myRects = segment(image);
14  
    Rect guess = rgbFindMostSimilarClip_multi(image, images, myRects, similarityThreshold);
15  
      
16  
    // submit
17  
    
18  
    Rect solution = first(submit(guess));
19  
    
20  
    // learn
21  
    
22  
    bool correct = solution == null ? guess == null : guess != null && solution.contains(centerOfRect(guess));
23  
    if (solution != null && !correct) {
24  
      solution = autoCropOfRGBImage_blackBG(image, solution);
25  
      Rect mine = smallestRectContaining(myRects, centerOfRect(solution));
26  
      if (mine != null) {
27  
        images.add(image.clip(mine));
28  
        is = showZoomedImage(is, "Memorized BLOBs", mergeImagesHorizontally(images));
29  
      }
30  
    }
31  
  }
32  
}

Author comment

Began life as a copy of #1006905

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: #1007106
Snippet name: MemorizeBrightBLOB3 (AI) - multiple images
Eternal ID of this version: #1007106/1
Text MD5: 98e16891e6df346b6018d40c91e5c7f3
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-03 02:03:14
Source code size: 971 bytes / 32 lines
Pitched / IR pitched: No / No
Views / Downloads: 480 / 647
Referenced in: [show references]