public static double Filter5(IntegralImage image, int x, int y, int w, int h, Func<double, double, double> cmp)
{
//Debug.Assert(x >= 0);
//Debug.Assert(y >= 0);
//Debug.Assert(w >= 1);
//Debug.Assert(h >= 1);
int w_3 = w / 3;
double a = image.Area(x + w_3, y, x + 2 * w_3 - 1, y + h - 1);
double b = image.Area(x, y, x + w_3 - 1, y + h - 1) +
image.Area(x + 2 * w_3, y, x + w - 1, y + h - 1);
return cmp(a, b);
}
}