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

12
LINES

< > BotCompany Repo | #1024736 // ocr_rightProfile_scaledTo127

JavaX fragment (include)

static byte[] ocr_rightProfile_scaledTo127(int n, double stopAtRatio, BWImage img) {
  int w = img.getWidth(), h = img.getHeight();
  int stopAt = min(w, iround(w*stopAtRatio));
  byte[] out = new byte[n];
  for y to n: {
    int realY = ifloor(y*h/n);
    int x = 0;
    while (x < stopAt && img.getPixel(w-1-x, realY) > 0.5f) ++x;
    out[y] = (byte) iround(x*127.0/stopAt);
  }
  ret out;
}

Author comment

Began life as a copy of #1024735

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: #1024736
Snippet name: ocr_rightProfile_scaledTo127
Eternal ID of this version: #1024736/1
Text MD5: 79cee06736cbe60ecec81684555b2090
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:49
Source code size: 404 bytes / 12 lines
Pitched / IR pitched: No / No
Views / Downloads: 146 / 168
Referenced in: [show references]