static BWImage iBWIntegralImageToBWImage(BWIntegralImage img) { int w = img.w, h = img.h; BWImage out = new(w, h); for y to h: for x to w: { int pixel = iround(bwIntegralImage_getPixelAverage(img, x, y, x+1, y+1)); out.setByte(x, y, (byte) pixel); } ret out; }