static IBWIntegralImage scaledIBWIntegralImage(BWIntegralImage img, int w, int h) { ret new IBWIntegralImage { int w1 = img.w, h1 = img.h; public int getWidth() { ret w; } public int getHeight() { ret h; } 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); } }; }