Libraryless. Compilation Failed (6414L/39K).
// background must be white static Pair<Pt> bwii_detectSingleLine(IBWIntegralImage ii) { int whiteValue = 255; int imgW = ii.getWidth(), imgH = ii.getHeight(); IIntIntPred predX = (x1, x2) -> ii.getPixelAverage(x1, 0, x2, imgH) != whiteValue; IIntIntPred predY = (y1, y2) -> ii.getPixelAverage(0, y1, imgW, y2) != whiteValue; // find bounding box Pair<Pt> endpoints = pair( pt(indexOfRangePredicate_IIntIntPred(imgW, predX), indexOfRangePredicate_IIntIntPred(imgH, predY)), pt(lastIndexOfRangePredicate_IIntIntPred(imgW, predX), lastIndexOfRangePredicate_IIntIntPred(imgH, predY))); // find out which diagonal it is if (ii.getPixel(endpoints.a) > ii.getPixel(endpoints.b.x, endpoints.a.y)) { int temp = endpoints.b.x; endpoints.b.x = endpoints.a.x; endpoints.a.x = temp; } ret endpoints; }
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1030509 |
Snippet name: | bwii_detectSingleLine |
Eternal ID of this version: | #1030509/16 |
Text MD5: | aed63258952572953ea8774b819c8b6f |
Transpilation MD5: | 5e7410f9519d12f5ae849c813989c0ac |
Author: | stefan |
Category: | javax / ocr |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-01-07 01:50:54 |
Source code size: | 883 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 265 / 383 |
Version history: | 15 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |