public void DoOcrMultiThread(Bitmap image, string lang) { tessnet2_64::tessnet2.Tesseract ocr = new tessnet2_64::tessnet2.Tesseract(); ocr.Init(null, lang, false); // If the OcrDone delegate is not null then this'll be the multithreaded version ocr.OcrDone = new tessnet2_64::tessnet2.Tesseract.OcrDoneHandler(Finished); // For event to work, must use the multithreaded version // ReSharper disable RedundantDelegateCreation ocr.ProgressEvent += new tessnet2_64::tessnet2.Tesseract.ProgressHandler(OcrProgressEvent); // ReSharper restore RedundantDelegateCreation mEvent = new ManualResetEvent(false); ocr.DoOCR(image, Rectangle.Empty); // Wait here it's finished mEvent.WaitOne(); }
public static List<tessnet2_64::tessnet2.Word> DoOcrNormal(Bitmap image, string lang) { tessnet2_64::tessnet2.Tesseract ocr = new tessnet2_64::tessnet2.Tesseract(); ocr.Init(null, lang, false); List<tessnet2_64::tessnet2.Word> result = ocr.DoOCR(image, Rectangle.Empty); DumpResult(result); return result; }