Exemplo n.º 1
0
        private void BtnReadImage_Click(object sender, EventArgs e)
        {
            /*DialogResult dialogResult = openFileDialog1.ShowDialog();
             *
             * if (dialogResult==DialogResult.OK)
             * {
             *  AutoOcr ocr = new AutoOcr() { Language = IronOcr.Languages.Turkish.OcrLanguagePack };
             *  Bitmap bitmap = new Bitmap(openFileDialog1.FileName);
             *  PctBox.Image = bitmap;
             *  OcrResult result= ocr.Read(bitmap);
             *
             *  RchText.Text = result.Text;
             * }*/

            //ocrProcess = new IronOcrProcess();
            ocrProcess = new TesseractProcess();

            DialogResult dialogResult = openFileDialog1.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                Bitmap bitmap = new Bitmap(openFileDialog1.FileName);
                PctBox.Image = bitmap;

                RchText.Text = ocrProcess.ReadImage(bitmap);
            }
        }
        public string ProcessCard(IOcrProcess ocr, string backPageDataPath, string frontPageDataPath = null)
        {
            if (frontPageDataPath != null)
            {
                IDCard.CardData.FrontSide = IdentityCardHelper.processCardImage(frontPageDataPath);
            }

            IDCard.CardData.BackSide = IdentityCardHelper.processCardImage(backPageDataPath);

            return(ocr.Process(backPageDataPath));
        }
        public PassportProcess(string backPageDataPath, IOcrProcess ocr)
        {
            IDCard = new IdentityCard();

            try
            {
                Text = ProcessCard(ocr, backPageDataPath);
            }
            catch (PathToFileNotFoundException ex)
            {
                throw ex;
            }
        }