static BufferedImage integralImageToBufferedImage(IntegralImage img) {
  if (img == null) null;
  int w = img.w, h = img.h;
  BufferedImage out = newBufferedImage(w, h);
  for y to h:
    for x to w:
      out.setRGB(x, y, ii_getPixel(img, x, y));
  ret out;
}

static BufferedImage integralImageToBufferedImage(IIntegralImage img) {
  ret img?.getBufferedImage();
}