public static void Main(string[] args) { const string language = "eng"; string imageFile = args[0]; TesseractProcessor processor = new TesseractProcessor(); using (Bitmap bmp = Bitmap.FromFile(imageFile) as Bitmap) { var success = processor.Init(TessractData, language, (int)eOcrEngineMode.OEM_DEFAULT); if (!success) { Console.WriteLine("Failed to initialize tesseract."); } else { // use thresholder processor.UseThresholder(); string text = processor.Recognize(bmp); Console.WriteLine("Text:"); Console.WriteLine("*****************************"); Console.WriteLine(text); Console.WriteLine("*****************************"); } } Console.WriteLine("Press any key to exit."); Console.ReadKey(); }
public static void Main(string[] args) { const string language = "eng"; string imageFile = args[0]; TesseractProcessor processor = new TesseractProcessor(); using (Bitmap bmp = Bitmap.FromFile(imageFile) as Bitmap) { var success = processor.Init(TessractData, language, (int)eOcrEngineMode.OEM_DEFAULT); if (!success) { Console.WriteLine("Failed to initialize tesseract."); } else { // use thresholder processor.UseThresholder(); string text = processor.Recognize(bmp); Console.WriteLine("Text:"); Console.WriteLine("*****************************"); Console.WriteLine(text); Console.WriteLine("*****************************"); } } Console.WriteLine("Press any key to exit."); Console.ReadKey(); }