Tessnet2用于。net -在tessocr退出。Init调用

时间:2022-11-22 08:58:14

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:

我有一个在Visual Studio 10中运行的。net控制台应用,Windows Vista家庭高级版。我正在尝试让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");
        }

The application exits with code 1 at the tessocr.Init call.

应用程序在tessocr处以代码1退出。Init调用。

I have placed all 9 eng language files in the debug directory of the application.

我已经在应用程序的调试目录中放置了所有的9个eng语言文件。

Not sure what else I can do?

不知道我还能做什么?

1 个解决方案

#1


1  

They need to be in a directory called "tessdata".

它们需要位于一个名为“tessdata”的目录中。

#1


1  

They need to be in a directory called "tessdata".

它们需要位于一个名为“tessdata”的目录中。