public static void Recognize() { int n_images = Workspace.Images.Length; int i_image = n_images - 1; i_image = 0; string fileName = Workspace.Images[i_image]; string imageFile = Path.Combine(Workspace.InputFolder, fileName); string language = "eng"; int oem = 3; TesseractProcessor processor = new TesseractProcessor(); using (Bitmap bmp = Bitmap.FromFile(imageFile) as Bitmap) { GreyImage greyImage = GreyImage.FromImage(bmp); DateTime started = DateTime.Now; AdaptiveThresholder thresholder = new AdaptiveThresholder(); BinaryImage binImage = thresholder.Threshold(greyImage); DateTime ended = DateTime.Now; Console.WriteLine("Duration thresholding: {0} ms", (ended - started).TotalMilliseconds); binImage.Invert(); //for (int i = 0; i < 4; i++) for (int i = 3; i < 4; i++) { oem = i; oem = (int)eOcrEngineMode.OEM_TESSERACT_CUBE_COMBINED; processor.Init(Workspace.TessdataFolder, language, oem); string text = ""; unsafe { started = DateTime.Now; //string text = processor.Recognize(bmp); text = processor.RecognizeBinaryImage( binImage.BinaryData, binImage.Width, binImage.Height); ended = DateTime.Now; Console.WriteLine("Duration recognition: {0} ms\n\n", (ended - started).TotalMilliseconds); } Console.WriteLine( string.Format("RecognizeMode: {1}\nText:\n{0}\n++++++++++++++++++++++++++++++++\n", text, ((eOcrEngineMode)oem).ToString())); } } }