tessnet2 fails to load

Jack picture Jack · Jan 13, 2010 · Viewed 23k times · Source

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!

Answer

Adam K Dean picture Adam K Dean · Feb 26, 2012

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! :)