// x1/y1/x2/y2 are dimensions of the inner (empty) part of the rectangle // w/h = line width/height static int bwIntegralImage_whiteRectWithBlackBorder(BWIntegralImage img, int x1, int y1, int x2, int y2, int w, int h) { ret bwIntegralImage_sumRect(img, x1, y1, x2, y2)*2 -bwIntegralImage_sumRect(img, x1-w, y1-h, x2+w, y2+h); }