Libraryless. Click here for Pure Java version (2600L/16K).
1  | static byte[] ocr_leftProfile_scaledTo127(int n, double stopAtRatio, BWImage img) {
 | 
2  | int w = img.getWidth(), h = img.getHeight();  | 
3  | int stopAt = min(w, iround(w*stopAtRatio));  | 
4  | byte[] out = new byte[n];  | 
5  |   for y to n: {
 | 
6  | int realY = ifloor(y*h/n);  | 
7  | int x = 0;  | 
8  | while (x < stopAt && img.getPixel(x, realY) > 0.5f) ++x;  | 
9  | out[y] = (byte) iround(x*127.0/stopAt);  | 
10  | }  | 
11  | ret out;  | 
12  | }  | 
Began life as a copy of #1024733
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1024735 | 
| Snippet name: | ocr_leftProfile_scaledTo127 | 
| Eternal ID of this version: | #1024735/9 | 
| Text MD5: | 80cbf27fe9c2729194e45064e57a96e6 | 
| Transpilation MD5: | 8bb470cdd628d5343405e890f41c8365 | 
| Author: | stefan | 
| Category: | javax / imaging | 
| Type: | JavaX fragment (include) | 
| Public (visible to everyone): | Yes | 
| Archived (hidden from active list): | No | 
| Created/modified: | 2019-08-24 15:37:55 | 
| Source code size: | 399 bytes / 12 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 463 / 595 | 
| Version history: | 8 change(s) | 
| Referenced in: | [show references] |