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

28
LINES

< > BotCompany Repo | #1006820 // Find Motion In Test Screenshots [probably works, shows most of moved window]

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

Libraryless. Click here for Pure Java version (5144L/36K/128K).

1  
!7
2  
3  
static float ppt = 0f;
4  
5  
p {
6  
  RGBImage a = loadRGBImage(#1006818), b = loadRGBImage(#1006819);
7  
  compare(a, b);
8  
}
9  
10  
svoid compare(RGBImage a, RGBImage b) {
11  
  //new HashSet<Pt> deltas;
12  
  new Best<Rect> best;
13  
  repeat {
14  
    Rect r = randomScreenRect(50, 50);
15  
    RGBImage clip = a.clip(r);
16  
    if (rgbInnerPrecision(clip) >= 0.5f) {
17  
      Rect r2 = rgbSearchPrecise(b, clip);
18  
      if (r2 != null && neq(r, r2)) {
19  
        Pt delta = new Pt(r2.x-r.x, r2.y-r.y);
20  
        Rect match = rgbExpandMatch(a, b, r, r2, ppt);
21  
        if (best.put(match, match.w*match.h)) {
22  
          print("New best. Movement: " + delta + ". Match size: " + match.w + "/" + match.h);
23  
          packFrameInTopRightCorner(quickShowImage(rgbScale(a.clip(match), 1)));
24  
        }
25  
      }
26  
    }
27  
  }
28  
}

Author comment

Began life as a copy of #1006814

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: #1006820
Snippet name: Find Motion In Test Screenshots [probably works, shows most of moved window]
Eternal ID of this version: #1006820/13
Text MD5: 51bce81124c698e0c48773b217287ec8
Transpilation MD5: 8d3184e85fe8f152c5fce71dbc28cf21
Author: stefan
Category: javax / ocr
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-09 01:00:25
Source code size: 800 bytes / 28 lines
Pitched / IR pitched: No / No
Views / Downloads: 396 / 476
Version history: 12 change(s)
Referenced in: [show references]