Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string program = Thread.GetDomain().BaseDirectory + "Tesseract-OCR";
            OpenCV Convert = new OpenCV();
            adb    a       = new adb();
            var    service = new TesseractService(program, "kor", program + @"\tessdata");

            while (true)
            {
                Run(a, service, Convert);
                Thread.Sleep(10000);
            }
        }
Ejemplo n.º 2
0
        private void Run(adb a, TesseractService service, OpenCV Convert)
        {
            //이미지 전처리 작업
            IplImage source = new IplImage();
            Bitmap   src    = new Bitmap(a.screenshot());

            source = Convert.Binary(Convert.Crop(src).ToIplImage());
            pictureBoxIpl1.ImageIpl = source;
            Bitmap savesrc  = new Bitmap(source.ToBitmap());
            string temppath = Thread.GetDomain().BaseDirectory + "temp.jpg";

            savesrc.Save(temppath);
            //여기까지 이미지 전처리


            //테서렉트5.0 가동
            var    stream = File.OpenRead(temppath);
            string text   = textedit.Edit(service.GetText(stream));

            MessageBox.Show(text);
        }