Libraryless. Click here for Pure Java version (5814L/33K).
static IIntegralImage scaledIntegralImage(IIntegralImage img, int w) { ret scaledIntegralImage(img, w, iround(w*img.getHeight()/(double) img.getWidth())); } static IIntegralImage scaledIntegralImage(IIntegralImage img, int w, int h) { ret new IIntegralImage { int w1 = img.getWidth(), h1 = img.getHeight(); double factorX = doubleRatio(w1, w); double factorY = doubleRatio(h1, h); double areaCorrection = 1/(factorX*factorY); public int getWidth() { ret w; } public int getHeight() { ret h; } // get value for 1 channel // normal range [0; pixelCount*256) // TODO: test public double getIntegralValue(int x, int y, int channel) { double x2 = (x+1)*factorX-1; double y2 = (y+1)*factorY-1; double val = img.getIntegralValue(x2, y2, channel); ifdef scaledIntegralImage_debug printVars scaledIntegralImage(+x, +y, +x2, +y2, +val, val2 := val*areaCorrection); endifdef ret val*areaCorrection; } }; }
Began life as a copy of #1027206
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj, pyentgdyhuwx
No comments. add comment
| Snippet ID: | #1032469 |
| Snippet name: | scaledIntegralImage |
| Eternal ID of this version: | #1032469/5 |
| Text MD5: | f5912a1945d44e82ba96cb92965c6c8e |
| Transpilation MD5: | 51a81ba4011c32ceaec3f161fb2aad58 |
| Author: | stefan |
| Category: | javax / imaging |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2021-09-08 05:39:41 |
| Source code size: | 1026 bytes / 28 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 357 / 456 |
| Version history: | 4 change(s) |
| Referenced in: | [show references] |