Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            const int        width  = 7;
            const int        height = 7;
            OrientationImage Obj    = new OrientationImage(height, width);

            float [] O = new float [height * width] {
                1.5f, 0, 2, 1, -1, -1, 2,
                3, -1.5f, 2, 0, 2, 2, 1,
                2, 0.5f, -1.5f, 0, 1, 1, 1.5f,
                2, 1, 0, -1, 0, -2, 0.5f,
                3, 0, -2, 1, -1, 0, 1,
                -1.5f, 0, -2, 2, 0, -2, 1.5f,
                1.5f, -0.5f, 0, 4, 1, 3, -1.5f
            };
            Console.WriteLine("Array:");
            for (int i = 0; i < height; i++)
            {
                for (int j = 0; j < width; j++)
                {
                    Console.Write("{0}  ", O[i * width + j]);
                }
                Console.Write("\n");
            }
            Console.Write("\n\n\n");
            float [] Fx  = Obj.VectorFieldX(O);
            float [] Fy  = Obj.VectorFieldY(O);
            float [] Fx1 = Obj.Filter(Fx);
            float [] Fy1 = Obj.Filter(Fy);
            Console.Write("\n\nFx1:\n");
            for (int i = 0; i < height; i++)
            {
                for (int j = 0; j < width; j++)
                {
                    Console.Write("{0} ", Fx1[i * width + j]);
                }
                Console.Write("\n");
            }
            Console.Write("\n\nFy1:\n");
            for (int i = 0; i < height; i++)
            {
                for (int j = 0; j < width; j++)
                {
                    Console.Write("{0} ", Fy1[i * width + j]);
                }
                Console.Write("\n");
            }
            Obj.LocalOrientation(ref O, Fx1, Fy1);
            Console.Write("\n\nO:\n");
            for (int i = 0; i < height; i++)
            {
                for (int j = 0; j < width; j++)
                {
                    Console.Write("{0} ", O[i * width + j]);
                }
                Console.Write("\n");
            }
            Console.ReadKey();
        }
Ejemplo n.º 2
0
 static void Main(string[] args)
 {
     const int width = 7;
      const int height = 7;
      OrientationImage Obj = new OrientationImage (height, width);
      float [] O = new float [height*width] {1.5f,    0,     2,  1,-1, -1,    2,
                                        3,-1.5f,     2,  0, 2,  2,    1,
                                        2, 0.5f, -1.5f,  0, 1,  1, 1.5f,
                                        2,     1,    0, -1, 0, -2, 0.5f,
                                        3,     0,   -2,  1,-1,  0,    1,
                                     -1.5f,    0,   -2,  2, 0, -2, 1.5f,
                                      1.5f, -0.5f,   0,  4, 1,  3,-1.5f };
     Console.WriteLine("Array:");
     for (int i = 0; i < height; i++)
      {
       for (int j = 0; j < width; j++)
        {
     Console.Write("{0}  ", O[i*width + j]);
        }
       Console.Write("\n");
      }
     Console.Write("\n\n\n");
     float [] Fx = Obj.VectorFieldX(O);
     float [] Fy = Obj.VectorFieldY(O);
     float [] Fx1 = Obj.Filter(Fx);
     float [] Fy1 = Obj.Filter(Fy);
     Console.Write("\n\nFx1:\n");
     for (int i = 0; i < height; i++)
      {
       for (int j = 0; j < width; j++) Console.Write("{0} ", Fx1[i*width + j]);
       Console.Write("\n");
       }
      Console.Write("\n\nFy1:\n");
      for (int i = 0; i < height; i++)
       {
        for (int j = 0; j < width; j++) Console.Write("{0} ", Fy1[i*width + j]);
        Console.Write("\n");
       }
     Obj.LocalOrientation(ref O, Fx1, Fy1);
     Console.Write("\n\nO:\n");
     for (int i = 0; i < height; i++)
      {
       for (int j = 0; j < width; j++) Console.Write("{0} ", O[i*width + j]);
       Console.Write("\n");
      }
     Console.ReadKey();
 }