Libraryless. Click here for Pure Java version (11630L/68K).
sclass ScaledIBWIntegralImage > Meta implements IBWIntegralImage { IBWIntegralImage img; int w, h; double factorX, factorY, areaCorrection; static ScaledIBWIntegralImage forHeight(int h, IBWIntegralImage img) { ret new ScaledIBWIntegralImage(widthForHeight(img.getWidth(), img.getHeight(), h), img); } *(int w, IBWIntegralImage img) { this(w, heightForWidth(img.getWidth(), img.getHeight(), w), img); } *(int *w, int *h, IBWIntegralImage *img) { h = heightForWidth(img.getWidth(), img.getHeight(), w); int w1 = img.getWidth(), h1 = img.getHeight(); factorX = doubleRatio(w1, w); factorY = doubleRatio(h1, h); 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 dbl getIIValue(double x, double y) { dbl x2 = (x+1)*factorX-1, y2 = (y+1)*factorY-1; dbl val = img.getIIValue(x2, y2)*areaCorrection; ifdef ScaledIBWIntegralImage_debug print("Scaled." + formatFunctionCall getIIValue(x, y, x2, y2) + "=" + val); endifdef ret val; } }
Began life as a copy of #1027206
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1033566 |
Snippet name: | ScaledIBWIntegralImage [OK] |
Eternal ID of this version: | #1033566/10 |
Text MD5: | 9ddb856f3f16d10550bc4b2e99e98174 |
Transpilation MD5: | 4e56c53b6bbca1d82b6244aa044d3344 |
Author: | stefan |
Category: | javax / imaging |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-01-05 02:02:14 |
Source code size: | 1201 bytes / 36 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 217 / 315 |
Version history: | 9 change(s) |
Referenced in: | [show references] |