static BufferedImage integralImageToBufferedImage(IntegralImage img) { if (img == null) null; int w = img.w, h = img.h; BufferedImage out = whiteImage(w, h); for y to h: for x to w: { int r = integralImage_sumRect(img, x, y, x+1, y+1, 0); int g = integralImage_sumRect(img, x, y, x+1, y+1, 1); int b = integralImage_sumRect(img, x, y, x+1, y+1, 2); out.setRGB(x, y, (r << 16) | (g << 8) | b); } ret out; }