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