Area() public method

public Area ( int x1, int y1, int x2, int y2 ) : double
x1 int
y1 int
x2 int
y2 int
return double
Ejemplo n.º 1
0
        // .......ooooooooo
        // .......ooooooooo
        // .......ooooooooo
        // .......ooooooooo
        public static double Filter2(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_2 = w / 2;

            double a = image.Area(x + w_2, y, x + w - 1, y + h - 1);
            double b = image.Area(x, y, x + w_2 - 1, y + h - 1);

            return(cmp(a, b));
        }
Ejemplo n.º 2
0
        // ................
        // oooooooooooooooo
        // ................
        public static double Filter4(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 h_3 = h / 3;

            double a = image.Area(x, y + h_3, x + w - 1, y + 2 * h_3 - 1);
            double b = image.Area(x, y, x + w - 1, y + h_3 - 1) +
                       image.Area(x, y + 2 * h_3, x + w - 1, y + h - 1);

            return(cmp(a, b));
        }
Ejemplo n.º 3
0
        public void TestArea()
        {
            double[] data = {
		        1.0, 2.0, 3.0,
		        4.0, 5.0, 6.0,
		        7.0, 8.0, 9.0,
	        };

            Image image = new Image(3, data);
            IntegralImage integral_image = new IntegralImage(image);

            Assert.AreEqual((1.0), integral_image.Area(0, 0, 0, 0));
            Assert.AreEqual((1.0 + 4.0), integral_image.Area(0, 0, 1, 0));
            Assert.AreEqual((1.0 + 4.0 + 7.0), integral_image.Area(0, 0, 2, 0));

            Assert.AreEqual((1.0) + (2.0), integral_image.Area(0, 0, 0, 1));
            Assert.AreEqual((1.0 + 4.0) + (2.0 + 5.0), integral_image.Area(0, 0, 1, 1));
            Assert.AreEqual((1.0 + 4.0 + 7.0) + (2.0 + 5.0 + 8.0), integral_image.Area(0, 0, 2, 1));

            Assert.AreEqual((2.0), integral_image.Area(0, 1, 0, 1));
            Assert.AreEqual((2.0 + 5.0), integral_image.Area(0, 1, 1, 1));
            Assert.AreEqual((2.0 + 5.0 + 8.0), integral_image.Area(0, 1, 2, 1));
        }
Ejemplo n.º 4
0
        // oooooooooooooooo
        // oooooooooooooooo
        // oooooooooooooooo
        // oooooooooooooooo
        public static double Filter0(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);

            double a = image.Area(x, y, x + w - 1, y + h - 1);
            double b = 0;
            return cmp(a, b);
        }
Ejemplo n.º 5
0
        // .......ooooooooo
        // .......ooooooooo
        // ooooooo.........
        // ooooooo.........
        public static double Filter3(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_2 = w / 2;
            int h_2 = h / 2;

            double a = image.Area(x, y + h_2, x + w_2 - 1, y + h - 1) +
                       image.Area(x + w_2, y, x + w - 1, y + h_2 - 1);
            double b = image.Area(x, y, x + w_2 - 1, y + h_2 - 1) +
                       image.Area(x + w_2, y + h_2, x + w - 1, y + h - 1);

            return cmp(a, b);
        }
Ejemplo n.º 6
0
 // oooooooooooooooo
 // oooooooooooooooo
 // oooooooooooooooo
 // oooooooooooooooo
 public static double Filter0(IntegralImage image, int x, int y, int w, int h, Func<double, double, double> cmp)
 {
     double a = image.Area(x, y, x + w - 1, y + h - 1);
     double b = 0;
     return cmp(a, b);
 }
Ejemplo n.º 7
0
        // .....oooooo.....
        // .....oooooo.....
        // .....oooooo.....
        // .....oooooo.....
        public static double Filter5(IntegralImage image, int x, int y, int w, int h, Func<double, double, double> cmp)
        {
            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);
        }
Ejemplo n.º 8
0
        // .......ooooooooo
        // .......ooooooooo
        // ooooooo.........
        // ooooooo.........
        public static double Filter3(IntegralImage image, int x, int y, int w, int h, Func<double, double, double> cmp)
        {
            int w_2 = w / 2;
            int h_2 = h / 2;

            double a = image.Area(x, y + h_2, x + w_2 - 1, y + h - 1) +
                       image.Area(x + w_2, y, x + w - 1, y + h_2 - 1);
            double b = image.Area(x, y, x + w_2 - 1, y + h_2 - 1) +
                       image.Area(x + w_2, y + h_2, x + w - 1, y + h - 1);

            return cmp(a, b);
        }