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

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:RecognizeWhiteListedCharacters
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_OMR();

            // Initialize an instance of OcrEngine
            OcrEngine ocrEngine = new OcrEngine();

            // Retrieve the OcrConfig of the OcrEngine object
            OCRConfig ocrConfig = ocrEngine.Config;

            // Set the Whitelist property to recognize numbers only
            ocrConfig.Whitelist = new char[] { '1', '2', '3', '4', '5', '6', '7', '8', '9', '0' };

            // Set the Image property of OcrEngine object
            ocrEngine.Image = ImageStream.FromFile(dataDir+ "Sampleocr.bmp");

            // Call the Process method to retrieve the results
            ocrEngine.Process();
            // ExEnd:RecognizeWhiteListedCharacters
        }
    }
RecognizeWhiteListedCharacters