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; } }