Aspose.OCR.Examples.CSharp.FormattingAndManipulatingOCR.SettingtheOcrEngine.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:SettingtheOcrEngine
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OMR();
            // Create an instance of OcrEngine class
            OcrEngine ocr = new OcrEngine();

            // Set the Image property of OcrEngine by reading an image file
            ocr.Image = ImageStream.FromFile(dataDir+ "Sampleocr.bmp");

            // Set the RemoveNonText to true
            ocr.Config.RemoveNonText = true;

            // Perform OCR operation
            if (ocr.Process())
            {
                // Display results
                Console.WriteLine(ocr.Text);
            }
            // ExEnd:SettingtheOcrEngine            
        }
    }
SettingtheOcrEngine