1 | static double[][] integralImage(BufferedImage img) { |
2 | ret integralImage(new BWImage(img)); |
3 | } |
4 | |
5 | ifclass RGBImage |
6 | static double[][] integralImage(RGBImage rgb) { |
7 | ret integralImage(toBW(rgb)); |
8 | } |
9 | endif |
10 | |
11 | static double[][] integralImage(BWImage bw) { |
12 | int w = bw.getWidth(), h = bw.getHeight(); |
13 | double[][] ii = new double[h][w]; |
14 | |
15 | for y to h: { |
16 | double rowSum = 0; |
17 | for x to w: { |
18 | rowSum += bw.getPixel(x, y); |
19 | ii[y][x] = y > 0 ? rowSum + ii[y-1][x] : rowSum; |
20 | } |
21 | } |
22 | |
23 | ret ii; |
24 | } |
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: | 114 / 134 |
Referenced in: | [show references] |