Specifies an analysis engine for OMR forms to compute their statistics and grades.
public class OmrAnalysisEngine
OmrAnalysisEngine can be used to compute filled-in forms grades. The answers get marked based on the filled-in form provided as an answer key in the Constructor of this class.
If no answer key is available, users can fill the OmrAnalysisEngine.Grades property by creating grade objects manually.
After properly filling the OmrAnalysisEngine.Grades and the OmrAnalysisEngine.FilledForms properties, the user can grade forms and generate the OmrGradesStatistics object using OmrAnalysisEngine.GradeForms.
Note
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 Visual Studio 2017 project.
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);
}
}