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

25
LINES

< > BotCompany Repo | #1010183 // findThingsOnScreen_1

JavaX fragment (include)

1  
static float findThingsOnScreen_1_scale = 0.25f; // scale image
2  
static SS findThingsOnScreen_1_db;
3  
4  
static L<S> findThingsOnScreen_1() {
5  
  bool consoleVisible = consoleVisible();
6  
  hideConsole();
7  
  sleep(500);
8  
  BufferedImage bigImg = shootScreen2();
9  
  if (consoleVisible) showConsole();
10  
  
11  
  BufferedImage img;
12  
  time "Make MBFImage" {
13  
    MBFImage image = readMBF(img = scaleImage(bigImg, findThingsOnScreen_1_scale));
14  
  }
15  
  if (findThingsOnScreen_1_db == null)
16  
    findThingsOnScreen_1_db = imageDB_md5ToNameMap();
17  
  
18  
  time "Segment" {
19  
    L<ConnectedComponent> components = fhSegment(image);
20  
  }
21  
  
22  
  L<S> found = lookupAllOpt(findThingsOnScreen_1_db, md5sOfImageComponents(img, components));
23  
  print("Found " + n(found, "thing") + " on screen: " + sfu(found));
24  
  ret found;
25  
}

Author comment

Began life as a copy of #1010171

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: #1010183
Snippet name: findThingsOnScreen_1
Eternal ID of this version: #1010183/4
Text MD5: 3aa085f04cc64d432d74e459cce7eb81
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-05 21:04:32
Source code size: 805 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 477 / 474
Version history: 3 change(s)
Referenced in: [show references]