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

11
LINES

< > BotCompany Repo | #1024705 // bwSimpleContrastValue - max-min

JavaX fragment (include)

static float bwSimpleContrastValue(BWImage bw) {
  if (bw == null) ret 0f;
  int w = bw.getWidth(), h = bw.getHeight();
  float min = 1, max = 0;
  for y to h: for x to w: {
    float f = bw.getPixel(x, y);
    max = max(max, f);
    min = min(min, f);
  }
  ret max-min;
}

Author comment

Began life as a copy of #1018878

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: #1024705
Snippet name: bwSimpleContrastValue - max-min
Eternal ID of this version: #1024705/1
Text MD5: 62228d3a97bb89f1433bf37ee7143992
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 12:07:52
Source code size: 283 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 149 / 177
Referenced in: [show references]