meta-for IntegralImage also as IIntegralImage { static int[] scaledPixelsFromIntegralImage(int w, IntegralImage img) { ret scaledPixelsFromIntegralImage(img, w); } static int[] scaledPixelsFromIntegralImage(IntegralImage img, int w, int h default heightForWidth(img, w)) { int w1 = img.getWidth(), h1 = img.getHeight(); double stepX = doubleRatio(w1, w), stepY = doubleRatio(h1, h); int[] pixels = new[w*h]; int i = 0; double srcY = 0; for y to h: { double srcX = 0, nextSrcY = srcY+stepY; for x to w: { double nextSrcX = srcX+stepX; dbl area = (x2-x1)*(y2-y1); dbl r = doubleRatio(img.rectSum(srcX, srcY, nextSrcX, nextSrcY, 0), area); dbl g = doubleRatio(img.rectSum(srcX, srcY, nextSrcX, nextSrcY), area); dbl b = doubleRatio(img.rectSum(srcX, srcY, nextSrcX, nextSrcY), area); pixels[i++] = rgbIntFromDoubles_fullAlpha(r, g, b); srcX = nextSrcX; } srcY = nextSrcY; } ret pixels; } }