static double[][] integralImage_45deg(BufferedImage img) {
ret integralImage(new BWImage(img));
}
static double[][] integralImage_45deg(BWImage bw) {
int w = bw.getWidth(), h = bw.getHeight();
double[][] ii = new double[h][w];
// instead of looking above, we look above to the left
// instead of looking left, we look left and down
for (int y1 = 0; y1 < h; y++) {
double rowSum = 0;
for (int x = 0; x <= y1; x++) {
int y = y1-x;
rowSum += bw.getPixel(x, y);
ii[y][x] = y > 0 && x > 0 ? rowSum + ii[y-1][x-1] : rowSum;
}
}
for (int x1 = 1; x1 < w; x1++) {
double rowSum = 0;
for (int yup = 0; yup < ?; yup++) {
int x = x1+yup, y = h-1-yup;
rowSum += bw.getPixel(x, y);
ii[y][x] = y > 0 && x > 0 ? rowSum + ii[y-1][x-1] : rowSum;
}
}
ret ii;
}Began life as a copy of #1009125
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1009143 |
| Snippet name: | integralImage_45deg - tilted 45 degrees |
| Eternal ID of this version: | #1009143/1 |
| Text MD5: | 03277aa756aeba2261c1a6babc3db592 |
| Author: | stefan |
| Category: | javax / gui |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2017-07-05 18:21:04 |
| Source code size: | 860 bytes / 30 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 917 / 906 |
| Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |