尝试执行 OCR 示例时 C# 出现异常
Exception on C# while trying to do OCR example
我正在使用 CnetSDK 在 C# 上尝试 OCR 应用程序。我有一个例外
"threw an exception. ---> System.TypeLoadException: Could not load type 'System.Web.HttpServerUtility' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral."
我按照网上类似帖子的建议尝试了很多方法,但似乎没有任何效果。有人有想法可以告诉我吗?
// Create an OCR Engine instance.
OcrEngine OCRLibrary = new OcrEngine();
// Set the absolute path of tessdata.
OCRLibrary.TessDataPath = "Desktop:/tessdata/";
// Set the target text language you want to recognize.
OCRLibrary.TextLanguage = "eng";
// Recognize text from image file.
string Imagetext = OCRLibrary.PerformOCR(@"Desktop:/driving.jpg");
System.Console.WriteLine(Imagetext);
你能分享一些你尝试过的东西吗?
该错误看起来像是在尝试引用 system.web dll 之一,您的项目是框架还是核心? CnetSDK官网上说是兼容.Net Framework 4.0及以上版本
检查您的项目是否为 .Net Framework > 4.0 项目
System.Web 不是 .net 核心的一部分,因此无法使用它。 https://github.com/dotnet/core/issues/838
希望对您有所帮助!
我正在使用 CnetSDK 在 C# 上尝试 OCR 应用程序。我有一个例外
"threw an exception. ---> System.TypeLoadException: Could not load type 'System.Web.HttpServerUtility' from assembly 'System.Web, Version=4.0.0.0, Culture=neutral."
我按照网上类似帖子的建议尝试了很多方法,但似乎没有任何效果。有人有想法可以告诉我吗?
// Create an OCR Engine instance.
OcrEngine OCRLibrary = new OcrEngine();
// Set the absolute path of tessdata.
OCRLibrary.TessDataPath = "Desktop:/tessdata/";
// Set the target text language you want to recognize.
OCRLibrary.TextLanguage = "eng";
// Recognize text from image file.
string Imagetext = OCRLibrary.PerformOCR(@"Desktop:/driving.jpg");
System.Console.WriteLine(Imagetext);
你能分享一些你尝试过的东西吗?
该错误看起来像是在尝试引用 system.web dll 之一,您的项目是框架还是核心? CnetSDK官网上说是兼容.Net Framework 4.0及以上版本
检查您的项目是否为 .Net Framework > 4.0 项目
System.Web 不是 .net 核心的一部分,因此无法使用它。 https://github.com/dotnet/core/issues/838
希望对您有所帮助!