DoOCR Closes active application in C#

277 Views Asked by At

I am developing Application in C# about OCR.

I use Tessnet2 as OCR engine, here is my code:

Bitmap image = new Bitmap(pictureBox1.Image);
tessnet2.Tesseract ocr = new tessnet2.Tesseract();
ocr.SetVariable("tessedit_char_whitelist", "0123456789"); // If digit only
ocr.Init(@"C:\Users\Mari\Documents\Visual Studio 2010\Projects\ocr\ocr\bin\Release", "eng", false); // To use correct tessdata
List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);

        foreach (tessnet2.Word word in result)
        {
            richTextBox1.Text = string.Format("{0} : {1}", word.Confidence, word.Text);
        }

When this code is executed, Application closes immediatly, without any error. Could anyone please advice what to do? Thanks

0

There are 0 best solutions below