【问题标题】:Tessnet2 close program with System.AccessViolationExceptionTessnet2 关闭程序与 System.AccessViolationException
【发布时间】:2019-07-08 13:08:15
【问题描述】:
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);
    }
}

我在这里得到 System.AccessViolationException:List&lt;tessnet2.Word&gt; result = ocr.DoOCR(image, Rectangle.Empty);

库tessnet2.dll for x86,跟x64情况一样。

【问题讨论】:

    标签: c# tessnet2


    【解决方案1】:

    问题在于图片文件的尺寸。在我将图片大小调整为 250x100px 后解决了

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-08-09
      • 1970-01-01
      • 1970-01-01
      • 2017-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多