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?
Remove the
ocr.SetVariable
methodAlso, don't point the path to the tessdata folder itself.
If you do want only to use numeric chars, you can use this code: