Libraryless. Click here for Pure Java version (2329L/15K/51K).
!7 static double[][] ii; p { ii = integralImage(toBW(new RGBImage(10, 10, Color.gray))); printStruct(ii); checkRect(rect(1, 1, 2, 2)); checkRect(rect(1, 2, 2, 2)); checkRect(rect(2, 2, 2, 2)); checkRect(rect(2, 3, 3, 3)); haarFeature(rect(1, 1, 2, 2), rect(3, 1, 2, 2)); } svoid checkRect(Rect r) { print("Expected: " + rectVolume(r)*0.5 + ", sum: " + iiSumRect(ii, r)); } svoid haarFeature(Rect black, Rect white) { if (rectVolume(black) != rectVolume(white)) fail("Unequal volumes: " + rectWithVolume(black) + "/" + rectWithVolume(white)); double value = iiSumRect(ii, white)-iiSumRect(ii, black); print("Haar " + black + " with " + white + " => " + value); }
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: | 521 / 717 |
Version history: | 8 change(s) |
Referenced in: | -