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

8
LINES

< > BotCompany Repo | #1020182 // averageSaturation

JavaX fragment (include)

static double averageSaturation(BufferedImage img) {
  if (img == null) ret 0;
  int w = img.getWidth(), h = img.getHeight();
  double sum = 0;
  for y to h: for x to w:
    sum += saturationFromRGB(img.getRGB(x, y));
  ret doubleRatio(sum, w*h);
}

Author comment

Began life as a copy of #1020181

download  show line numbers  debug dex  old transpilations   

Travelled to 8 computer(s): bhatertpkbcr, cfunsshuasjs, gwrvuhgaqvyk, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1020182
Snippet name: averageSaturation
Eternal ID of this version: #1020182/1
Text MD5: 595c3100d904cd37bceafe09549aafe8
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-12-09 21:06:26
Source code size: 255 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 213 / 258
Referenced in: [show references]