static int bwIntegralImage_sumRect(BWIntegralImage img, int x1, int y1, int x2, int y2) { int bottomLeft = img.get(x1-1, y2-1); int bottomRight = img.get(x2-1, y2-1); int topLeft = img.get(x1-1, y1-1); int topRight = img.get(x2-1, y1-1); ret bottomRight+topLeft-topRight-bottomLeft; }