Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

tessnet2 fails to load

Tags:

c#

crash

tessnet2

i'm using the tessnet2 wrapper to the Tesseract 2.04 Source on windows XP, configured it to work with x86.

TessarctTest project main function contains:

        Bitmap bmp = new Bitmap(@"C:\temp\New Folder\dotnet\eurotext.tif");
        tessnet2.Tesseract ocr = new tessnet2.Tesseract();
        // ocr.SetVariable("tessedit_char_whitelist", "0123456789");
        ocr.Init(@"C:\temp\tessdata", "eng", false);
        // List<tessnet2.Word> r1 = ocr.DoOCR(bmp, new Rectangle(792, 247, 130, 54));
        List<tessnet2.Word> r1 = ocr.DoOCR(bmp, Rectangle.Empty);
        int lc = tessnet2.Tesseract.LineCount(r1);

when i try to run the program it crashes on the following line inside the ocr.Init

int result = m_myTessBaseAPIInstance->InitWithLanguage((char *)_tessdata.ToPointer(), NULL, (char *)_lang.ToPointer(), NULL, numericMode, 0, NULL);

Any one has an idea?

Appreciate!

like image 780
Jack Avatar asked Jan 13 '10 00:01

Jack


1 Answers

For anyone still having a problem after all these, make sure if you're using tessnet2 that you download the correct language files.

You want English language data for Tesseract (2.00 and up) and not the English language data for Tesseract 3.01 version. I hope this saves you a few hours! :)

like image 154
Adam K Dean Avatar answered Oct 12 '22 02:10

Adam K Dean