Optical mark recognition (OMR)

To recognize a filled questionnaire, answer sheet, ballot, or other OMR form, digitize it in one of the supported formats. For best results, we recommend using a scanner (a basic office scanner or multifunction copier will suffice). If you do not have a scanner, you can simply take a picture of the form with any modern smartphone and upload the photo to your computer.

Initializing the recognition engine

Aspose.OMR recognition engine is initialized with the recognition pattern (a file with .OMR extension), generated along with the printable form. The recognition pattern is loaded using GetTemplateProcessor method of Aspose.OMR.Api.OmrEngine class:

Aspose.OMR.Api.OmrEngine omrEngine = new Aspose.OMR.Api.OmrEngine();
Aspose.OMR.Api.TemplateProcessor templateProcessor = omrEngine.GetTemplateProcessor("pattern.omr");

You can also load the recognition pattern as a MemoryStream object, which can be very useful when building web applications or APIs:

byte[] pattern = Encoding.UTF8.GetBytes(payload);
Aspose.OMR.Api.OmrEngine omrEngine = new Aspose.OMR.Api.OmrEngine();
Aspose.OMR.Api.TemplateProcessor templateProcessor = null;
using(MemoryStream ms = new MemoryStream(pattern))
{
	templateProcessor = omrEngine.GetTemplateProcessor(ms, Encoding.UTF8);
}

Recovering a recognition pattern file

If you have lost the recognition pattern file for the survey, simply generate it again from the form source code using exactly the same paper size, orientation, font, and other layout setting.

Recognizing OMR form from a single respondent

To recognize a completed form, process its scan or photo through Recognize method of the initialized recognition engine. You can supply a form as:

  • An absolute or relative path to the image (for single-page forms).
  • An absolute or relative path to the scanned PDF (for single-page or multi-page forms).
  • A memory stream containing a scan or a photo of the form in any of the supported formats. Useful for building web applications or APIs.
  • An array of paths to scanned form pages (for multi-page forms).
  • An array of memory streams containing scans or photographs of the completed form pages in any of the supported formats. Useful for building web applications or APIs.

Regardless of the completed form format, the recognition method supports accuracy adjustments for reliable results under various conditions.

Bulk recognition

The whole idea behind OMR is to automatically process hundreds of forms. Aspose.OMR for .NET greatly simplifies this task by allowing you to recognize a directory with form images using a single method rather than recognizing files one by one:

Aspose.OMR.Api.OmrEngine omrEngine = new Aspose.OMR.Api.OmrEngine();
Aspose.OMR.Api.TemplateProcessor templateProcessor = omrEngine.GetTemplateProcessor("pattern.omr");
Aspose.OMR.Model.RecognitionResult recognitionResults[] = templateProcessor.RecognizeFolder(@"C:\final_exam\");

Saving recognition results

Recognition results are returned in the most popular data storage formats that can be imported into any popular database or analysis system: CSV, XML or JSON. See more information in the dedicated article.

Interactive adjustments and debugging

You can use the graphical user interface control bundled with Aspose.OMR for .NET package to interactively fine tuning recognition accuracy before batch processing a large number of scanned forms or for investigating recognition problems.