Provides a high level OMR forms functionality to create forms objects and process forms fields.
public class OmrEngine public class OmrEngine Public Class OmrEngine public:ref class OmrEngine
LEADTOOLS OMR toolkit provides high-level classes to process OMR bubbles in exams and surveys. OmrEngine allows creating forms, automatic detection of OMR bubbles, automatic alignment, and processing of different types of fields.
LEADTOOLS supports OmrFields, OcrField, ImageField and BarcodeField.
OmrField can be easily detected and extracted by providing the area of the group of OMR bubbles using ITemplateForm.ExtractInfo.
The OmrEngine can be used to create and load ITemplateForm and IRecognitionForm internal objects.
OMR Example Workflow
The following example is a snippet of a larger example that demonstrates a basic workflow using LEADTOOLS OMR:
1. Create and initialize a new OmrEngine
2. Load the RasterImage
3. Create an ITemplateForm object from the rasterimage
4. Create a few zones and add them to the template
5. Save the template to a file on disk
6. Apply OMR to the answer key
7. Apply OMR to the individual forms
8. Analyze the documents and print the results
9. Shut down the OcrEngine associated with this OmrEngineYou can also download the complete example in Visual Studio 2017.
using Leadtools;using Leadtools.Barcode;using Leadtools.Codecs;using Leadtools.Forms.Processing.Omr;using Leadtools.Forms.Processing.Omr.Fields;using Leadtools.Ocr;// Main Workflow Example Sourcestatic void Main(string[] args){if (SetLicense() == false){Console.WriteLine("Either the license is not set, or OMR functionality is not supported.");Console.WriteLine("Application will exit.");return;}// create and initialize a new OmrEngineOmrEngine engine = OmrEngineExamples.CreateOmrEngine();// load a rasterimage that the template will use as a sourcestring inputImagePath = Path.Combine(LEAD_VARS.ImagesDir, @"Forms\OMR Processing\Exam\exam.tif");RasterImage templateImage = engine.EnginesObject.RasterCodecs.Load(inputImagePath);// create an ITemplateForm object from the rasterimageITemplateForm template = OmrEngineExamples.CreateNewTemplate(templateImage, engine);// create a few zones and add them to the templateOmrFieldExamples.AddZonesToTemplate(template);// save our constructed template to a file on diskITemplateFormExamples.SaveTemplateToDisk(template);// apply OMR to the answer keyIRecognitionForm answers = IRecognitionFormExamples.RecognizeForm(template, engine);// apply OMR to the individual formsList<IRecognitionForm> recognizedForms = IRecognitionFormExamples.RecognizeMultipleForms(template, engine);// analyze the documents and print the resultsOmrEngineExamples.PerformAnalysis(recognizedForms, answers);// shut down the OcrEngine associated with this OmrEngineengine.EnginesObject.OcrEngine.Shutdown();}private static bool SetLicense(){string licenseFile = @"C:\LEADTOOLS 21\Support\Common\License\LEADTOOLS.LIC";string key = System.IO.File.ReadAllText(@"C:\LEADTOOLS 21\Support\Common\License\LEADTOOLS.LIC.key");try{RasterSupport.SetLicense(licenseFile, key);}catch (Exception){return false;}return !RasterSupport.IsLocked(RasterSupportType.Omr);}// OMR Engine Example Sourcepublic static OmrEngine CreateOmrEngine(){OmrEngine omrEngine = new OmrEngine();// the OmrEngine requires an OcrEngine to be associated with it and for that engine to be startedIOcrEngine engine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD);engine.Startup(null, null, null, null);omrEngine.EnginesObject.OcrEngine = engine;omrEngine.EnginesObject.BarcodeEngine = new BarcodeEngine();// the OmrEngine also has a property for a RasterCodecs object we can use for convenienceRasterCodecs codecs = new RasterCodecs();codecs.Options.Load.Resolution = 300;codecs.Options.Load.XResolution = 300;codecs.Options.Load.YResolution = 300;codecs.Options.RasterizeDocument.Load.Resolution = 300;codecs.Options.RasterizeDocument.Load.XResolution = 300;codecs.Options.RasterizeDocument.Load.YResolution = 300;omrEngine.EnginesObject.RasterCodecs = codecs;return omrEngine;}static class LEAD_VARS{public const string ImagesDir = @"C:\LEADTOOLS21\Resources\Images";}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
