예제 #1
0
 public WoWProcess()
 {
     Instance = this;
     Process  = Process.GetProcessesByName("WowClassic")[0];
     User32.GetWindowRect(Process.MainWindowHandle, ref ProcessRectangle);
     FocusProcess();
 }
예제 #2
0
        private void CaptureButtonClick(object sender, EventArgs e)
        {
            IsRunning = true;

            _wowProcess = new WoWProcess();

            // Start Capture

            _imageProcessor = new ImageProcessing();
            _character      = new Character();
            _navigation     = new Navigation();
            //Program.CaptureThread = new Thread(_imageProcessor.OnUpdate);
            // Program.CaptureThread.Start();
            UpdateLoop();

            //while (IsRunning)
            //{
            //    // convert image to grayscale
            //    Bitmap templateImage = new Bitmap(_neutralHp);
            //    Grayscale grayScale = new GrayscaleBT709();
            //    Bitmap grayTemplate = grayScale.Apply(templateImage);
            //    // create template matching algorithm's instance
            //    ExhaustiveTemplateMatching tm = new ExhaustiveTemplateMatching(0);

            //    // find all matchings with specified above similarity
            //    Bitmap sourceImage = new Bitmap(_originalBitMap);
            //    Bitmap graySource = grayScale.Apply(sourceImage);
            //    TemplateMatch[] matchings = tm.ProcessImage(graySource, grayTemplate);

            //    Graphics g = Graphics.FromImage(sourceImage);
            //    var rect = new Rect(685, 275, 110, 65);
            //    for (int i = 0; i < matchings.Length; i++)
            //    {
            //        if (matchings[i].Similarity > 0.90f)
            //        {
            //            if (matchings[i].Rectangle.Size.Width < 25) continue;
            //            int X = matchings[i].Rectangle.X;
            //            int Y = matchings[i].Rectangle.Y;

            //            g.DrawRectangle(new Pen(Color.Red, 3), X, Y, matchings[i].Rectangle.Width, matchings[i].Rectangle.Height);
            //            DebugImage.Image = sourceImage;

            //            g.DrawRectangle(new Pen(Color.Red, 3), rect.X1, rect.Y1, rect.Width,rect.Height);
            //        }

            //    }

            //    TesseractEngine engine = new Tesseract.TesseractEngine("./TessData", "eng", Tesseract.EngineMode.TesseractOnly);
            //    Page page =engine.Process(_originalBitMap,rect, Tesseract.PageSegMode.Auto);

            //    wait(200);
            //}
        }