Aspose.OCR.Examples.CSharp.FormattingAndManipulatingOMR.SetImageResolution.Run C# (CSharp) Method

Run() public static method

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

            // Load template file
            OmrTemplate template = OmrTemplate.Load(dataDir + "questions.amr");

            // Load the image to be analyzed
            OmrImage image = OmrImage.Load(dataDir + "answers.jpg");

            // Define new value of image resolution in decimal format
            image.Resolution = 100.0;

            // Instantiate the recognition engine for the template
            OmrEngine engine = new OmrEngine(template);

            // Extract data. This template has only one page.
            OmrProcessingResult result = engine.ExtractData(new OmrImage[] { image });

            // Load actual result from
            Hashtable OmrResult = result.PageData[0];

            // Get Collection of Keys
            ICollection key = OmrResult.Keys;

            foreach (string k in key)
            {
                Console.WriteLine(k + ": " + OmrResult[k]);
            }
            // ExEnd:SetImageResolution
        }
    }
SetImageResolution