Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tessnet2 for .Net - exits at the tessocr.Init call

Tags:

.net

tesseract

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?

like image 371
Paul Sachs Avatar asked Nov 14 '22 03:11

Paul Sachs


1 Answers

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

like image 124
Jarrod Avatar answered Dec 28 '22 19:12

Jarrod