My code below gave me the exception "Attempted to read or write
protected memory. This is often an indication that other memory is
corrupt.". It seemed like if two threads ran this function at the same
time (note ocr is on the stack and local) this exception would occur.
To fix it i wrote Lock(SomeStaticObject) {} around this and i no
longer had the exception.
using (var bmp = new
System.Drawing.Bitmap(tempFileFN))
{
using (tessnet2.Tesseract ocr = new
tessnet2.Tesseract())
{
ocr.Init(null, null, false);
List<tessnet2.Word> result =
ocr.DoOCR(bmp, System.Drawing.Rectangle.Empty);
captchaResults = result[0].Text;
Console.WriteLine("trying captcha file
{0} word = {1}", tempFile, result[0]);
}
}
--
You received this message because you are subscribed to the Google Groups
"tesseract-ocr" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/tesseract-ocr?hl=en.