static int bwIntegralImage_sumRect(BWIntegralImage img, int x1, int y1, int x2, int y2) { int bottomLeft = img.getIIValue(x1-1, y2-1); int bottomRight = img.getIIValue(x2-1, y2-1); int topLeft = img.getIIValue(x1-1, y1-1); int topRight = img.getIIValue(x2-1, y1-1); ret bottomRight+topLeft-topRight-bottomLeft; } meta-for int in int, dbl { static int bwIntegralImage_sumRect(IBWIntegralImage img, int x1, int y1, int x2, int y2) { int bottomLeft = img.getIIValue(x1-1, y2-1); int bottomRight = img.getIIValue(x2-1, y2-1); int topLeft = img.getIIValue(x1-1, y1-1); int topRight = img.getIIValue(x2-1, y1-1); ret bottomRight+topLeft-topRight-bottomLeft; } }