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

19
LINES

< > BotCompany Repo | #1032501 // blendBWIntegralImages

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

Transpiled version (8435L) is out of date.

static BWIntegralImage blendBWIntegralImages(Cl<? extends IIntegralImage> images) {
  if (empty(images)) null;
  var img1 = first(images);
  int nImages = l(images);
  int w = img1.getWidth(), h = img1.getHeight(), n = w*h;
  double[] pixels = new[w*h];
  for (var img : images) {
    int i = 0;
    for y to h:
      for x to w:
        pixels[i++] += img.getPixel(x, y, 0);
  }
  
  byte[] bytes = new[n];
  double inv = 1.0/nImages;
  for i to n: bytes[i] = clampToUByte(iround(pixels[i]*inv));
  
  ret new BWIntegralImage(BWImage(w, h, bytes));
}

Author comment

Began life as a copy of #1019595

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx

No comments. add comment

Snippet ID: #1032501
Snippet name: blendBWIntegralImages
Eternal ID of this version: #1032501/6
Text MD5: fec5eec6bf95303ea5a78399581e0472
Author: stefan
Category: javax / imaging
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-09-11 16:50:31
Source code size: 569 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 162 / 233
Version history: 5 change(s)
Referenced in: [show references]