Hi i am trying to get Tessnet2 to work. My code is
Bitmap image = new Bitmap(@"C:\Users\Eric\Desktop\Text Pictures\Oil0.bmp");
tessnet2.Tesseract ocr = new tessnet2.Tesseract();
ocr.SetVariable("tessedit_char_whitelist", "0123456789");
ocr.Init(@"C:\tessdata", "eng", false);
List<tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty); // Error occurs here
foreach (tessnet2.Word word in result)
Console.WriteLine("{0} : {1}", word.Confidence, word.Text);
When i run it i get the error "System.AccessViolationException" at List result = ocr.DoOCR(image, Rectangle.Empty);
I am using .net 3.5 and i got really no idea whats wrong here. Any suggestions?
1.make sure if you're using tessnet2 that you download the correct language files.You should use English language data for Tesseract (2.00 and up) and not the English language data for Tesseract 3.01 version.Download correct data from below link. https://code.google.com/p/tesseract-ocr/downloads/list
2.If you installed any tesseract-ocr-setup.exe means your program always refer tessdata file under C:\Program Files\Tesseract-OCR\tessdata location because setup Installation time it will create a environment variable TESSDATA_PREFIX with value **C:\Program Files\Tesseract-OCR** .To solve this issue uninstall setup and remove environment variable or keep your tessdata files under C:\Program Files\Tesseract-OCR\tessdata location.