static IBWIntegralImage scaledIBWIntegralImage(IBWIntegralImage img, int w) { ret scaledIBWIntegralImage(img, w, iround(w*img.getHeight()/(double) img.getWidth())); } static IBWIntegralImage scaledIBWIntegralImage(IBWIntegralImage img, int w, int h) { ret new IBWIntegralImage { 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 getIIValue(int x, int y) { ret img.getIIValue(x*factorX, y*factorY)*areaCorrection; } public double getPixelAverage(int x1, int y1, int x2, int y2) { int _x1 = x1*w1/w, _x2 = x2*w1/w; int _y1 = y1*h1/h, _y2 = y2*h1/h; ret img.getPixelAverage(_x1, _y1, _x2, _y2); } }; }