public static double PrimitiveMiddle(IntegralImage img, int x, int y, int width, int height)
 {
     return(img.RegionSum(x, x + width / 3, y, y + height) - img.RegionSum(x + width / 2, x + width, y, y + height) + img.RegionSum(x + width / 2, x + width, y, y + height));
 }
 public static double PrimitiveHorizontal(IntegralImage img, int x, int y, int width, int height)
 {
     return(img.RegionSum(x, x + width, y, y + height / 2) - img.RegionSum(x, x + width, y + height / 2, y + height));
 }