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

24
LINES

< > BotCompany Repo | #1034888 // integralImage old

JavaX fragment (include)

static double[][] integralImage(BufferedImage img) {
  ret integralImage(new BWImage(img));
}

ifclass RGBImage
static double[][] integralImage(RGBImage rgb) {
  ret integralImage(toBW(rgb));
}
endif

static double[][] integralImage(BWImage bw) {
  int w = bw.getWidth(), h = bw.getHeight();
  double[][] ii = new double[h][w];
  
  for y to h: {
    double rowSum = 0;
    for x to w: {
      rowSum += bw.getPixel(x, y);
      ii[y][x] = y > 0 ? rowSum + ii[y-1][x] : rowSum;
    }
  }

  ret ii;
}

Author comment

Began life as a copy of #1009125

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

-
Snippet ID: #1034888
Snippet name: integralImage old
Eternal ID of this version: #1034888/1
Text MD5: 725e273bb2bc7ee2ab15c4a0d49aaf95
Author: stefan
Category: javax / gui
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-03-13 01:24:18
Source code size: 523 bytes / 24 lines
Pitched / IR pitched: No / No
Views / Downloads: 113 / 132
Referenced in: