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

13
LINES

< > BotCompany Repo | #1027295 // bwLocalMaximaFilter

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

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

1  
static BWImage bwLocalMaximaFilter(BWImage img) {
2  
  int w = img.getWidth(), h = img.getHeight();
3  
  BWImage img2 = new(w, h);
4  
  for y to h:
5  
    for x to w:
6  
      img2.setPixel(x, y,
7  
        img.getPixel(x, y)-
8  
        (img.getPixel(x, max(0, y-1)) +
9  
        img.getPixel(max(0, x-1), y) +
10  
        img.getPixel(min(w-1, x+1), y) +
11  
        img.getPixel(x, min(h-1, y+1)))/4);
12  
  ret img2;
13  
}

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: #1027295
Snippet name: bwLocalMaximaFilter
Eternal ID of this version: #1027295/1
Text MD5: 204b7b5f7e3efd7b771de8120cc3bf1e
Transpilation MD5: 2880fd0f75bff6075aa8666c870cdc76
Author: stefan
Category: javax / images
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-02-29 23:55:07
Source code size: 398 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 182 / 260
Referenced in: [show references]