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).

// resulting image is of size (img.w()-blurw, img.h()-blurh)

meta-for IntegralImage also as IIntegralImage {

  static int[] blurredPixelsFromIntegralImage(int blurw, int blurh default blurw, IntegralImage img) {
    int w1 = img.getWidth(), h1 = img.getHeight();
    int w = w1-blurw, h = h1-blurh;
    if (w < 0 || h < 0) null;
    int[] pixels = new[w*h];
    int i = 0;
    double area = blurw*blurh;
    
    for y to h: {
      for x to w: {
        dbl r = doubleRatio(img.rectSum(x, y, x+blurw, y+blurh, 0), area);
        dbl g = doubleRatio(img.rectSum(x, y, x+blurw, y+blurh, 1), area);
        dbl b = doubleRatio(img.rectSum(x, y, x+blurw, y+blurh, 2), area);
        pixels[i++] = rgbIntFromDoubles_fullAlpha(r, g, b);
      }
    }
    
    ret pixels;
  }

}

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