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

33
LINES

< > BotCompany Repo | #1006854 // rgbExpandMatch

JavaX fragment (include)

static Rect rgbExpandMatch(RGBImage a, RGBImage b, Rect r1, Rect r2, float ppt) {
  assertEquals(r1.w, r2.w);
  assertEquals(r1.h, r2.h);
  int w = a.w(), h = a.h();
  //print("Comparing " + r1 + " and " + r2);
  repeat {
    Rect r = r1;
    
    // left
    if (r2.x > 0 && r1.x > 0 && rgbImageSectionsIdentical_ppt(a, new Rect(r1.x-1, r1.y, 1, r1.h), b, new Rect(r2.x-1, r2.y, 1, r2.h), ppt)) {
      r1 = growRectLeft(r1, 1); r2 = growRectLeft(r2, 1);
    }
    
    // right
    if (r2.x2() < w && r2.x2() < w && rgbImageSectionsIdentical_ppt(a, new Rect(r1.x2(), r1.y, 1, r1.h), b, new Rect(r2.x2(), r2.y, 1, r2.h), ppt)) {
      r1 = growRectRight(r1, 1); r2 = growRectRight(r2, 1);
    }
  
    // top
    if (r2.y > 0 && r1.y > 0 && rgbImageSectionsIdentical_ppt(a, new Rect(r1.x, r1.y-1, r1.w, 1), b, new Rect(r2.x, r2.y-1, r2.w, 1), ppt)) {
      r1 = growRectTop(r1, 1); r2 = growRectTop(r2, 1);
    }
    
    // bottom
    if (r2.y2() < h && r2.y2() < h && rgbImageSectionsIdentical_ppt(a, new Rect(r1.x, r1.y2(), r1.w, 1), b, new Rect(r2.x, r2.y2(), r2.w, 1), ppt)) {
      r1 = growRectBottom(r1, 1); r2 = growRectBottom(r2, 1);
    }
    
    if (eq(r, r1)) break;
  }
 
  ret r1;
}

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: #1006854
Snippet name: rgbExpandMatch
Eternal ID of this version: #1006854/3
Text MD5: a36b4e36fbd1ccfc9b2093cbf3e05d00
Author: stefan
Category: javax / ocr
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-02-11 02:47:29
Source code size: 1231 bytes / 33 lines
Pitched / IR pitched: No / No
Views / Downloads: 543 / 556
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)