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

14
LINES

< > BotCompany Repo | #1027298 // bwLocalMaximaFilter_autoContrast

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (5165L/33K).

static BWImage bwLocalMaximaFilter_autoContrast(BWImage img) {
  int w = img.getWidth(), h = img.getHeight();
  float[] f = new[w*h];
  int i = 0;
  for y to h:
    for x to w:
      f[i++] = 
        img.getPixel(x, y)-
        (img.getPixel(x, max(0, y-1)) +
        img.getPixel(max(0, x-1), y) +
        img.getPixel(min(w-1, x+1), y) +
        img.getPixel(x, min(h-1, y+1)))/4;
  ret iBWAutoContrast(iBWImageFromFloats(w, f));
}

Author comment

Began life as a copy of #1027295

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1027298
Snippet name: bwLocalMaximaFilter_autoContrast
Eternal ID of this version: #1027298/3
Text MD5: 0d024615aaff0a6fd78ec94aebd6727b
Transpilation MD5: a72a9f767f86bc63eda297d4860a46d0
Author: stefan
Category: javax / images
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-03-01 00:02:56
Source code size: 447 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 154 / 220
Version history: 2 change(s)
Referenced in: [show references]