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)

1  
static float bwSimpleContrastValue(BWImage bw) {
2  
  if (bw == null) ret 0f;
3  
  int w = bw.getWidth(), h = bw.getHeight();
4  
  float min = 1, max = 0;
5  
  for y to h: for x to w: {
6  
    float f = bw.getPixel(x, y);
7  
    max = max(max, f);
8  
    min = min(min, f);
9  
  }
10  
  ret max-min;
11  
}

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: 223 / 254
Referenced in: [show references]