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

13
LINES

< > BotCompany Repo | #1005863 // img_leftishness

JavaX fragment (include)

static float img_leftishness(BWImage image) {
  float middle = image.getWidth()/2f;
  float sum = 0;
  for (int y = 0; y < image.getHeight(); y++) {
    int x1 = img_leftmostPoint(image, y);
    int x2 = img_rightmostPoint(image, y);
    if (x2 > x1) {
      float center = (x1+x2)/2f;
      sum += (middle-center)/middle;
    }
  }
  ret sum/image.getHeight();
}

Author comment

Began life as a copy of #1005854

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, sawdedvomwva, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005863
Snippet name: img_leftishness
Eternal ID of this version: #1005863/1
Text MD5: 241995ff2f07987fead2dc24facb1224
Author: stefan
Category: javax / ocr
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-12-11 08:16:38
Source code size: 375 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 421 / 429
Referenced in: [show references]