C#中的Tessnet2错误 [英] Tessnet2 error in C#

查看:211
本文介绍了C#中的Tessnet2错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我通过以下代码在C#中使用Tessnet2 ocr:

I am using Tessnet2 ocr in C# by following codes:

 tessnet2.Tesseract ocr = new tessnet2.Tesseract();
            ocr.SetVariable("tessedit_char_whitelist", "0123456789");
            ocr.Init(Application.StartupPath + @"D:\\Program Files (x86)\\Visual Studio 2010\\Projects\\AForgeTest2\\AForgeTest2\\tessdata\\", "eng", true);
            List<tessnet2.Word> result = ocr.DoOCR(numberTest, Rectangle.Empty);
            string code = result[0].Text;
            testBox1.Text = code;

但是当我运行调试时,它在第5行显示错误消息:

but when I run the debug it shows the error message in the 5th line:

static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());//the line with error
        }

FileLoadException被取消处理:
混合模式程序集是针对运行时的版本"v2.0.50727"构建的,如果没有其他配置信息,则无法在4.0运行时中加载.

FileLoadException was Unhandle:
Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.


你知道如何解决这个问题吗?


Do you know how to solve this problem?

亲切问候
Gav

Kind Regards
Gav

推荐答案

我认为将项目的目标框架从4.0更改为2.0会有所帮助.

I think changing the target framework of your project from 4.0 to 2.0 will help.

请参阅:更改目标.NET Framework版本或配置文件现有项目

这篇关于C#中的Tessnet2错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆