1 | static Rect rgbExpandMatch(RGBImage a, RGBImage b, Rect r1, Rect r2, float ppt) { |
2 | assertEquals(r1.w, r2.w); |
3 | assertEquals(r1.h, r2.h); |
4 | int w = a.w(), h = a.h(); |
5 | //print("Comparing " + r1 + " and " + r2); |
6 | repeat { |
7 | Rect r = r1; |
8 | |
9 | // left |
10 | 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)) { |
11 | r1 = growRectLeft(r1, 1); r2 = growRectLeft(r2, 1); |
12 | } |
13 | |
14 | // right |
15 | 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)) { |
16 | r1 = growRectRight(r1, 1); r2 = growRectRight(r2, 1); |
17 | } |
18 | |
19 | // top |
20 | 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)) { |
21 | r1 = growRectTop(r1, 1); r2 = growRectTop(r2, 1); |
22 | } |
23 | |
24 | // bottom |
25 | 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)) { |
26 | r1 = growRectBottom(r1, 1); r2 = growRectBottom(r2, 1); |
27 | } |
28 | |
29 | if (eq(r, r1)) break; |
30 | } |
31 | |
32 | ret r1; |
33 | } |
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: | 544 / 557 |
Version history: | 2 change(s) |
Referenced in: | [show references] |