asmrobot
2019-11-25 2aeab450471cb80b59002da7da80faf251a0c4f4
src/test/Program.cs
@@ -7,6 +7,9 @@
using System.Drawing;
using System.Reflection.Emit;
using System.Reflection;
using Tesseract;
using Emgu.CV;
using Emgu.CV.Structure;
namespace test
{
@@ -177,38 +180,63 @@
    }
    class Program
    {
       
        static void Main(string[] args)
        {
            person a = new person(235, "a0");
            person b = new person(12, "b1");
            person c = new person(34, "c2");
            person d = new person(45, "d3");
            person e = new person(56, "e4");
            Dijkstra<person> dij = new Dijkstra<person>();
            dij.AddVertex(a, new Dictionary<person, int>() { { b, 7 }, { d, 8 } });
            dij.AddVertex(b, new Dictionary<person, int>() { { a, 7 }, { c, 2 },{ d,2} ,{ e,3} });
            dij.AddVertex(c, new Dictionary<person, int>() { { b, 8 }, { e, 6 } });
            dij.AddVertex(d, new Dictionary<person, int>() { { a, 8 },{ b,2} });
            dij.AddVertex(e, new Dictionary<person, int>() { { b, 1 },{ c,2} });
            Image<Rgb, byte> image = RichCreator.Utility.Captures.ScreenCapture.Instance.CaptureScreenReturnImage();
            int i = 0;
            ZTImage.Diagnostics.CodeTimer.Timer("test", 100000, () => {
            dij.ShortestPath(d, e).ForEach(x => Console.WriteLine(x));
            ZTImage.Diagnostics.CodeTimer.Timer("dij", 10000, () =>
            {
                //g.ShortestPath('A', 'H').ForEach(x => Console.WriteLine(x));
                dij.ShortestPath(a, b);
                byte b1 = image.Data[i % 53, i % 37,0];
                byte b2 = image.Data[i % 53, i % 37, 1];
                Int32 total = b1 + b2;
                if (total > 300000)
                {
                    Console.WriteLine("oik");
                }
            });
            //person a = new person(235, "a0");
            //person b = new person(12, "b1");
            //person c = new person(34, "c2");
            //person d = new person(45, "d3");
            //person e = new person(56, "e4");
            //Dijkstra<person> dij = new Dijkstra<person>();
            //dij.AddVertex(a, new Dictionary<person, int>() { { b, 7 }, { d, 8 } });
            //dij.AddVertex(b, new Dictionary<person, int>() { { a, 7 }, { c, 2 },{ d,2} ,{ e,3} });
            //dij.AddVertex(c, new Dictionary<person, int>() { { b, 8 }, { e, 6 } });
            //dij.AddVertex(d, new Dictionary<person, int>() { { a, 8 },{ b,2} });
            //dij.AddVertex(e, new Dictionary<person, int>() { { b, 1 },{ c,2} });
            //dij.ShortestPath(d, e).ForEach(x => Console.WriteLine(x));
            //ZTImage.Diagnostics.CodeTimer.Timer("dij", 10000, () =>
            //{
            //    //g.ShortestPath('A', 'H').ForEach(x => Console.WriteLine(x));
            //    dij.ShortestPath(a, b);
            //});
            //Bitmap bm = new Bitmap("d:\\t2.png");
            //var ocr = new TesseractEngine("./tessdata", "eng", EngineMode.TesseractAndCube);
            //Page page=ocr.Process(bm);
            //string text=page.GetText();
            //Console.WriteLine("识别出文字:" + text);
            Console.ReadKey();
        }
        
    }
}