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).

!7

static float ppt = 0f;

p {
  RGBImage a = loadRGBImage(#1006818), b = loadRGBImage(#1006819);
  compare(a, b);
}

svoid compare(RGBImage a, RGBImage b) {
  //new HashSet<Pt> deltas;
  new Best<Rect> best;
  repeat {
    Rect r = randomScreenRect(50, 50);
    RGBImage clip = a.clip(r);
    if (rgbInnerPrecision(clip) >= 0.5f) {
      Rect r2 = rgbSearchPrecise(b, clip);
      if (r2 != null && neq(r, r2)) {
        Pt delta = new Pt(r2.x-r.x, r2.y-r.y);
        Rect match = rgbExpandMatch(a, b, r, r2, ppt);
        if (best.put(match, match.w*match.h)) {
          print("New best. Movement: " + delta + ". Match size: " + match.w + "/" + match.h);
          packFrameInTopRightCorner(quickShowImage(rgbScale(a.clip(match), 1)));
        }
      }
    }
  }
}

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: 390 / 467
Version history: 12 change(s)
Referenced in: [show references]