1 | static double[][] integralImage_45deg(BufferedImage img) { |
2 | ret integralImage(new BWImage(img)); |
3 | } |
4 | |
5 | static double[][] integralImage_45deg(BWImage bw) { |
6 | int w = bw.getWidth(), h = bw.getHeight(); |
7 | double[][] ii = new double[h][w]; |
8 | |
9 | // instead of looking above, we look above to the left |
10 | // instead of looking left, we look left and down |
11 | for (int y1 = 0; y1 < h; y++) { |
12 | double rowSum = 0; |
13 | for (int x = 0; x <= y1; x++) { |
14 | int y = y1-x; |
15 | rowSum += bw.getPixel(x, y); |
16 | ii[y][x] = y > 0 && x > 0 ? rowSum + ii[y-1][x-1] : rowSum; |
17 | } |
18 | } |
19 | |
20 | for (int x1 = 1; x1 < w; x1++) { |
21 | double rowSum = 0; |
22 | for (int yup = 0; yup < ?; yup++) { |
23 | int x = x1+yup, y = h-1-yup; |
24 | rowSum += bw.getPixel(x, y); |
25 | ii[y][x] = y > 0 && x > 0 ? rowSum + ii[y-1][x-1] : rowSum; |
26 | } |
27 | } |
28 | |
29 | ret ii; |
30 | } |
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: | 504 / 508 |
Referenced in: | [show references] |