OmrAnalysisEngine Class
Summary
Specifies an analysis engine for OMR forms to compute their statistics and grades.
Syntax
public class OmrAnalysisEngine
public class OmrAnalysisEngine
Public Class OmrAnalysisEngine
public:
ref class OmrAnalysisEngine
Example
The following example is a snippet of a larger example project. To run the larger example project, follow the work flow laid out in the OMREngine example.
You 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.Ocr;
public static void PerformAnalysis(List<IRecognitionForm> recognizedForms, IRecognitionForm answers)
{
int threshold = 70; // pass/fail threshold value
OmrAnalysisEngine omrAnalysisEngine = new OmrAnalysisEngine(recognizedForms, answers);
omrAnalysisEngine.PassingScore = threshold;
// this call generates both the OmrGradesStatistics and populates the IRecognitionForm.Grade and Score properties
OmrGradesStatistics statistics = omrAnalysisEngine.GradeForms();
// print out the generated basic statistics (skipping the histogram)
Console.WriteLine("Statistics");
PropertyInfo[] properties = statistics.GetType().GetProperties();
for (int i = 0; i < properties.Length; i++)
{
PropertyInfo pi = properties[i];
if (pi.PropertyType == typeof(Double) || pi.PropertyType == typeof(UInt32))
{
Console.WriteLine("{0}:\t{1}", pi.Name, pi.GetValue(statistics));
}
}
// print out the final grade for each exam
for (int i = 0; i < recognizedForms.Count; i++)
{
IRecognitionForm form = recognizedForms[i];
string text = string.Format("{0}:\t {1}%", form.Name, form.Grade.ToString("0.#"));
Console.WriteLine(text);
}
}