0
private void Recognize()
{
    Bitmap image = new Bitmap(@"C:\OCRTest\test.jpg");
    pictureBox1.Image = image;
    tessnet2.Tesseract ocr = new tessnet2.Tesseract();
    ocr.SetVariable("tessedit_char_whitelist", "0123456789");
    ocr.Init(@"C:\Users\user1\source\repos\Prog1\tessdata\", "eng", false); // To use correct tessdata
    List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);
    foreach (tessnet2.Word word in result)
    {
        textBox1.Text = string.Format("{0} : {1}", word.Confidence, word.Text);
    }
}

I get System.AccessViolationException here: List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty);

Library tessnet2.dll for x86, with x64 the same situation.

HMD
  • 2,202
  • 6
  • 24
  • 37

1 Answers1

0

Problem was in picture file dimensions. Was solved after I resize picture to 250x100px