Libraryless. Click here for Pure Java version (2329L/15K/51K).
1 | !7 |
2 | |
3 | static double[][] ii; |
4 | |
5 | p { |
6 | ii = integralImage(toBW(new RGBImage(10, 10, Color.gray))); |
7 | printStruct(ii); |
8 | checkRect(rect(1, 1, 2, 2)); |
9 | checkRect(rect(1, 2, 2, 2)); |
10 | checkRect(rect(2, 2, 2, 2)); |
11 | checkRect(rect(2, 3, 3, 3)); |
12 | haarFeature(rect(1, 1, 2, 2), rect(3, 1, 2, 2)); |
13 | } |
14 | |
15 | svoid checkRect(Rect r) { |
16 | print("Expected: " + rectVolume(r)*0.5 + ", sum: " + iiSumRect(ii, r)); |
17 | } |
18 | |
19 | svoid haarFeature(Rect black, Rect white) { |
20 | if (rectVolume(black) != rectVolume(white)) |
21 | fail("Unequal volumes: " + rectWithVolume(black) + "/" + rectWithVolume(white)); |
22 | double value = iiSumRect(ii, white)-iiSumRect(ii, black); |
23 | print("Haar " + black + " with " + white + " => " + value); |
24 | } |
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1009126 |
Snippet name: | Test integralImage |
Eternal ID of this version: | #1009126/9 |
Text MD5: | 7998d67e926964a27bfc4ce6f3bc9621 |
Transpilation MD5: | a166b019105f72943a0cc0760bb5b157 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-07-05 23:42:53 |
Source code size: | 714 bytes / 24 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 520 / 716 |
Version history: | 8 change(s) |
Referenced in: | [show references] |