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

27
LINES

< > BotCompany Repo | #1006217 // Try to find URL area in browser [works for me]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (4355L/30K/102K).

1  
!752
2  
3  
// static for extraction by Performance Collector
4  
static RGBImage img;
5  
static L<Rect> clips;
6  
static Rect bestClip;
7  
8  
p {
9  
  img = rgbShootScreenHidingConsole();
10  
  calc();
11  
  showImage("Possible URL box", img.clip(bestClip));
12  
}
13  
14  
svoid calc {
15  
  Color color = Color.white;
16  
  clips = areasColored(img, color);
17  
  print(n(clips, "areas") + " found for color " + new RGB(color) + ": " + struct(clips));
18  
  
19  
  bestClip = bestAccordingTo(clips, f scoreClip);
20  
}
21  
22  
static double scoreClip(Rect r) {
23  
  double width = min(1, r.w/(double) img.w()*2);
24  
  double top = r.y/(double) img.h();
25  
  double height = r.h/(double) img.h();
26  
  ret width-(top+height)*2; // thin, wide, high up
27  
}

Author comment

Began life as a copy of #1006216

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1006217
Snippet name: Try to find URL area in browser [works for me]
Eternal ID of this version: #1006217/1
Text MD5: 60f1e789b198b67bfecd70bde234de69
Transpilation MD5: b659d42d0818a0540a7a64ca1ce1a26f
Author: stefan
Category: javax / ocr
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-23 17:31:33
Source code size: 693 bytes / 27 lines
Pitched / IR pitched: No / No
Views / Downloads: 551 / 888
Referenced in: [show references]