Tesseract 3.02无法加载DLL

时间:2021-06-17 21:08:27

I'm trying to create a simple OCR program using Tesseract .Net wrapper for tesseract-ocr. I tried the sample project and it worked like a charm. The problem is, when I run my wpf project an Unable to load DLL 'libtesseract302': The specified module could not be found. error occurs Nothing to do with the code. I tried Dependency Walker ad it says that I am missing 3 DLLs. They seem to be Windows DLLs but they don't exist here: Windows API Sets Any idea what's going on?

我正在尝试使用Tesseract . net包装器为tesserac - OCR创建一个简单的OCR程序。我尝试了这个示例项目,它非常成功。问题是,当我运行wpf项目时,无法加载DLL 'libtesseract302':无法找到指定的模块。错误与代码无关。我试过依赖步行者广告说我少了3个dll。它们似乎是Windows dll,但这里不存在:Windows API设置了什么内容?

EDIT:

编辑:

I changed the target framework to 4 from 4.5, and there is nothing wrong with these DLLs now (the example project which is working perfectly is using NET Framework 4.0).

我将目标框架从4.5更改为4,现在这些dll并没有什么问题(运行良好的示例项目使用的是NET framework 4.0)。

Now the problem is: Failed to initialise Tesseract Engine. Here is my simple code if that helps:

现在的问题是:未能初始化Tesseract引擎。如果有帮助的话,下面是我的简单代码:

        try
        {
            using (TesseractEngine engine = new TesseractEngine(@"./tessdata", "eng", EngineMode.Default))
            {
                using (Pix img = Pix.LoadFromFile(filename))
                {
                    using (Tesseract.Page page = engine.Process(img))
                    {
                        text = page.GetText();
                    }
                }
            }

        }
        catch (Exception ex)
        {
            text = ex.Message;
        }
        finally
        {
            conv_text_tb.Text = text;
        }

1 个解决方案

#1


0  

Okay I found out the fix to that error. I changed the Copy to Output Directory property of the DLL files and the files located in the tessdata folder to Copy Always. It's working perfectly now.

我找到了修正错误的方法。我将DLL文件和位于tessdata文件夹中的文件复制到输出目录属性,并一直复制。现在的工作完美。

#1


0  

Okay I found out the fix to that error. I changed the Copy to Output Directory property of the DLL files and the files located in the tessdata folder to Copy Always. It's working perfectly now.

我找到了修正错误的方法。我将DLL文件和位于tessdata文件夹中的文件复制到输出目录属性,并一直复制。现在的工作完美。