我使用teseract v2到OCR图像,它在exe中运行良好,但是当我尝试在WCF上每隔一段时间做这件事时我得到了这个例外:
尝试读取或写入受保护的内存。这通常表明其他内存已损坏。
与exe(work)和wcf(exception)相同的代码:
var processor = new TesseractProcessor();
processor.SetVariable("tessedit_char_whitelist", Metadata.TextRegexPattern);
processor.Init(@"../../tessdata/" + Language + ".traineddata", Language, 3);
processor.SetPageSegMode(_pageSegmentationMode);
processor.AnalyseLayout(source);
return processor.Recognize(Image.FromFile(filePath)); // here's problem with recognize method