Tessnet2 for .Net - 在 tessocr.Init 调用时退出
我有一个在 Visual Studio 10、Windows Vista Home Premium 中运行的 .net 控制台应用程序。我正在尝试让 tessnet2 示例正常工作。这是我的代码:
Ocr ocr = new Ocr();
using (var bmp = new Bitmap(@"C:\aaa\a-nsl\Caselines\Scanned Documents\Test_Scan_04.jpg"))
{
var tessocr = new tessnet2.Tesseract();
tessocr.Init(@"C:\Users\Paul\Documents\visual studio 2010\Projects\tessnet2Wpf\ConsoleApplication1\bin\Debug", "eng", false);
tessocr.GetThresholdedImage(bmp, Rectangle.Empty).Save("c:\\temp\\" + Guid.NewGuid() + ".bmp");
// Tessdata directory must be in the directory than this exe
Console.WriteLine("Multithread version");
ocr.DoOCRMultiThred(bmp, "eng");
Console.WriteLine("Normal version");
ocr.DoOCRNormal(bmp, "eng");
}
应用程序在 tessocr.Init 调用时退出,代码为 1。
我已将所有 9 个 eng 语言文件放置在应用程序的 debug 目录中。
不确定我还能做什么?
I have a .net console app running in Visual Studio 10, Windows Vista Home Premium. I am trying to get the tessnet2 example to work. here is my code:
Ocr ocr = new Ocr();
using (var bmp = new Bitmap(@"C:\aaa\a-nsl\Caselines\Scanned Documents\Test_Scan_04.jpg"))
{
var tessocr = new tessnet2.Tesseract();
tessocr.Init(@"C:\Users\Paul\Documents\visual studio 2010\Projects\tessnet2Wpf\ConsoleApplication1\bin\Debug", "eng", false);
tessocr.GetThresholdedImage(bmp, Rectangle.Empty).Save("c:\\temp\\" + Guid.NewGuid() + ".bmp");
// Tessdata directory must be in the directory than this exe
Console.WriteLine("Multithread version");
ocr.DoOCRMultiThred(bmp, "eng");
Console.WriteLine("Normal version");
ocr.DoOCRNormal(bmp, "eng");
}
The application exits with code 1 at the tessocr.Init call.
I have placed all 9 eng language files in the debug directory of the application.
Not sure what else I can do?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它们需要位于名为“tessdata”的目录中。
They need to be in a directory called "tessdata".