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

25
LINES

< > BotCompany Repo | #1035236 // blurredPixelsFromIntegralImage

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

Libraryless. Click here for Pure Java version (11489L/66K).

1  
// resulting image is of size (img.w()-blurw, img.h()-blurh)
2  
3  
meta-for IntegralImage also as IIntegralImage {
4  
5  
  static int[] blurredPixelsFromIntegralImage(int blurw, int blurh default blurw, IntegralImage img) {
6  
    int w1 = img.getWidth(), h1 = img.getHeight();
7  
    int w = w1-blurw, h = h1-blurh;
8  
    if (w < 0 || h < 0) null;
9  
    int[] pixels = new[w*h];
10  
    int i = 0;
11  
    double area = blurw*blurh;
12  
    
13  
    for y to h: {
14  
      for x to w: {
15  
        dbl r = doubleRatio(img.rectSum(x, y, x+blurw, y+blurh, 0), area);
16  
        dbl g = doubleRatio(img.rectSum(x, y, x+blurw, y+blurh, 1), area);
17  
        dbl b = doubleRatio(img.rectSum(x, y, x+blurw, y+blurh, 2), area);
18  
        pixels[i++] = rgbIntFromDoubles_fullAlpha(r, g, b);
19  
      }
20  
    }
21  
    
22  
    ret pixels;
23  
  }
24  
25  
}

Author comment

Began life as a copy of #1034885

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035236
Snippet name: blurredPixelsFromIntegralImage
Eternal ID of this version: #1035236/1
Text MD5: df678607f2915297eccc03e1a3f41762
Transpilation MD5: 389d7fee9e6fb3274993c766559a985a
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-04-21 01:54:59
Source code size: 799 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 135 / 189
Referenced in: [show references]