static RGBImage integralImageToRGBImage(IntegralImage img) { if (img == null) null; int w = img.w, h = img.h; RGBImage out = new(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.setPixel(x, y, r, g, b); } ret out; }