Auto Detect the Resolution of OmrImage and Better Exception Handling with Aspose.OCR for .Net 2.8.0

Aspose.OCR for .NET logo We are pleased to announce that Aspose.OCR for .NET 2.8.0 is now available for public use. This release includes exception handling to capture failures caused by the OmrEngine and a new OmrImage property to auto detect the image resolution of the OMR scanned image. Please review the release notes of Aspose.OCR for .NET 2.8.0 for a complete view of new feature & enhancements. If you are planning to upgrade the API from any previous version, we strongly suggest you to check the Public API Changes section to know what has been changed since your current revision of the API.

Auto Detect the Resolution of OmrImage

Aspose.OCR for .Net now provides the OmrImage.AutoDetectResolution property to auto detect the resolution of the scanned image to perform OMR operation. The OmrEngine tries to compare the resolution detected for the scanned image with the resolution of the OMR template. If they do not match with a slight tolerance, the OmrEngine generates an exception.

The following code snippet demonstrates how to use the newly exposed property to auto detect the image resolution.

//Load the image to be analyzed
OmrImage image = OmrImage.Load("sample.jpg");

//Set the auto image resolution detection property
image.AutoDetectResolution = true;

//Load template file
OmrTemplate template = OmrTemplate.Load("sample.amr");

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

//Extract data
OmrProcessingResult result = engine.ExtractData(new OmrImage[] { image });

//Do Processing

Exception Handling for OmrEngine

This release of the Aspose.OCR for .NET API has exposed the Aspose.OMR.OmrException class along with it’s supporting methods that allows to handle the exceptions caused by the OmrEngine during the processing of OMR forms.

Simple usage scenario of OmrException class is as follow

//Enclose your code in a try catch structure
   //Create an instance of OmrTemplate and load the .amr file
   OmrTemplate template = OmrTemplate.Load("sample.amr");

   //Create an instance of OmrImage and load the scanned form
   OmrImage image = OmrImage.Load(imageName);

   //Create an instance of OmrEngine and initialize it with OmrTemplate
   OmrEngine engine = new OmrEngine(template);

   //Process the OMR form
   OmrProcessingResult result = engine.ExtractData(new OmrImage[] { image });
//Handle exceptions
catch (OmrException e)

Aspose.OCR for .Net Resources

The resources, you may need to accomplish your tasks:

As always, we appreciate your feedback so if you ever have anything to tell us about this release or anything else, please head to the Aspose.OCR forum for a chat.