Optical mark recognition (OMR) API for .NET

Overview | Documentation | API Reference | Online apps | Showcases | Blog | Free support | Temporary license
This package can be used to develop applications for on-premise operating systems and cloud platforms. You can build both 32-bit and 64-bit software, including ASP.NET, WCF, and WinForms.
Please note: our library implies the use of .NET programming languages, compatible with CLI infrastructure. If you require a corresponding native library for C++, you can download it from here.
API overview
Aspose.OMR for .NET can generate and recognize hand-filled answer sheets, surveys, applications, and similar machine-readable forms. With it, you can quickly develop on-premise and web-based .NET applications for optical mark recognition (OMR) that work without specialized hardware. Respondents can fill out your forms with a pen or pencil and use any type of marks - we guarantee reliable results.
- Complete OMR workflow - from designing a form to recognizing filled hardcopies.
- Use your existing office copier or a smartphone camera instead of an expensive OMR scanner.
- Add and recognize QR codes and barcodes.
- Recognition of multi-page forms.
- Supports right-to-left (RTL) languages and Eastern Arabic numerals.
- No external editors and design tools are required.
- Supports all popular paper sizes as well as a number of non-standard ones.
- Full compatibility with other Aspose products - build solutions of any complexity using familiar concepts with minimal code.
Markup languages
Aspose.OMR for .NET offers several ways to design OMR forms of any layout and complexity. They all work equally well and produce the same results - just choose the approach that you are most comfortable with.
Supported file formats
Aspose.OMR for .NET can generate machine-readable forms in all popular formats. The format is intellectually selected based on the provided extension:
- PDF
- JPEG
- PNG
- TIFF
- GIF
- BMP
Aspose.OMR for .NET can read just about any image that you get from a scanner or camera:
- PDF
- JPEG
- PNG
- TIFF
- GIF
- BMP
Recognition results are returned in the most popular document and data exchange formats:
- JSON
- XML
- Comma-separated values (CSV)
Get started
You can get familiar with Aspose.OMR for .NET by creating 2 minimal console applications for creating and recognizing machine-readable forms.
Generating OMR form
-
Create a new C# project in Visual Studio. You can use a very basic project template, such as Console App.
-
Install this NuGet package to the project.
-
Create a simple questionnaire in a plain-text file that uses a special notation. Save the file to bin\Debug directory of the project under the name template.txt
.
?text=Hello, World!
font_style=bold
font_size=24
align=center
#How are you doing today?
() Pretty good, thanks! () I won't respond until I see my lawyer.
-
Create an instance of Aspose.OMR.Api.OmrEngine class:
Aspose.OMR.Api.OmrEngine omrEngine = new Aspose.OMR.Api.OmrEngine();
-
Generate a form from the template source file:
Aspose.OMR.Generation.GenerationResult generationResult = omrEngine.GenerateTemplate("template.txt");
-
Save the result:
generationResult.Save("", "Hello.OMR");
Full code:
namespace HelloOMR
{
internal class Program
{
static void Main(string[] args)
{
Aspose.OMR.Api.OmrEngine omrEngine = new Aspose.OMR.Api.OmrEngine();
Aspose.OMR.Generation.GenerationResult generationResult = omrEngine.GenerateTemplate("template.txt");
generationResult.Save("", "Hello.OMR");
}
}
}
Now run the program. You should get 2 files in bin\Debug directory of the project:
- Hello.OMR.png
A printable form in PNG format. Since we have not provided a license, there will be a watermark on the page.
- Hello.OMR.omr
A recognition pattern used by Aspose.OMR recognition engine. This file is required for recognizing filled forms, make sure you do not accidentally delete it!
Reading filled form
- Create a new C# project in Visual Studio. You can use a very basic project template, such as Console App.
- Install this NuGet package to the project.
- Print the generated form (Hello.OMR.png).
- Mark an answer bubble.
- Take a photo of the filled form (the entire sheet with all crop marks) with your smartphone and upload the photo to bin\Debug directory of the project.
- Copy the previously generated recognition pattern (Hello.OMR.omr) into bin\Debug directory of the project.
- Create an instance of Aspose.OMR.Api.OmrEngine class:
Aspose.OMR.Api.OmrEngine omrEngine = new Aspose.OMR.Api.OmrEngine();
- Load the recognition pattern from Hello.OMR.omr file:
Aspose.OMR.Api.TemplateProcessor templateProcessor = omrEngine.GetTemplateProcessor("Hello.OMR.omr");
- Recognize the photo of the filled form:
Aspose.OMR.Model.RecognitionResult recognitionResult = templateProcessor.RecognizeImage("IMG_20220401.jpg");
- Convert the recognition result to comma-separated values (CSV) format and output it to the console:
string result = recognitionResult.GetCsv();
Console.WriteLine(result);
Full code:
using System;
namespace HelloOMR
{
internal class Program
{
static void Main(string[] args)
{
Aspose.OMR.Api.OmrEngine omrEngine = new Aspose.OMR.Api.OmrEngine();
Aspose.OMR.Api.TemplateProcessor templateProcessor = omrEngine.GetTemplateProcessor("Hello.OMR.omr");
Aspose.OMR.Model.RecognitionResult recognitionResult = templateProcessor.RecognizeImage("IMG_20220401.jpg");
string result = recognitionResult.GetCsv();
Console.WriteLine(result);
Console.ReadLine();
}
}
}
Now run the program. You should see results of the recognition in the console output:
Element Name,Value,
Question1,"{Answer bubble letter}"
Learn more