static float horizontalAutoSplit2_threshold = 0.5f; static L<Rect> horizontalAutoSplit2(BWImage img) { ret horizontalAutoSplit2(img, horizontalAutoSplit2_threshold); } static L<Rect> horizontalAutoSplit2(BWImage img, float threshold) { int w = img.getWidth(), h = img.getHeight(); float[] f = bwImageColumnMinBrightness(img); new L<Rect> l; int j = -1; for (int i = 0; i < l(f); i++) if (f[i] < threshold) { // start / continue streak if (j < 0) j = i; } else { if (j >= 0) { // end streak l.add(new Rect(j, 0, i-j, h)); j = -1; } } if (j >= 0) l.add(new Rect(j, 0, w-j, h)); ret l; }
Began life as a copy of #1005709
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1005843 |
| Snippet name: | horizontalAutoSplit2 - uses min brightness per column |
| Eternal ID of this version: | #1005843/2 |
| Text MD5: | 4813f2bb4e9a7180486c5be8d563d3e6 |
| Author: | stefan |
| Category: | javax / ocr |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-10-08 00:52:05 |
| Source code size: | 680 bytes / 25 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 697 / 738 |
| Version history: | 1 change(s) |
| Referenced in: | [show references] |