Hi,
I’m using the attached template and I want to extract the content of the checkmark so I want to know what is checked and what is unchecked.
I’m using the template with the image attached but, with this code, I know there are 5 elements but none of them are filled:
var template = OmrTemplate.Load(“Assets/Template.amr”);
var image = OmrImage.Load(“Assets/Test.jpg”);
var engine = new OmrEngine(template);
var result = engine.ExtractData(new OmrImage[] { image });
var page = result.PageData[0];
What I’m doing wrong ?
Thanks!
Hi Thomas,
Thank you for contacting Aspose support.
I have checked your provided samples, and I have noticed two major issues as detailed below.
- In your template file, you have created the elements but haven’t assigned a designated value to each element. You can do that by double clicking the element and inserting required value. At the time of performing the OMR operation, the API will return the designated values against each element. Currently there is no value so the API returns null for each element. Please check the attachment for the modified template with some values assigned.
- In the sample image, a few of of the check boxes are partially filled so when you perform the OMR operation such partially filled check boxes are identified as unchecked. You can avoid this situation by assigning a lower threshold value for the OmrEngine. Please check the following piece of code for better understanding.
C#
//Load Template
var template = OmrTemplate.Load(“D:/modified.amr”);
//Load Image
var image = OmrImage.Load(“D:/Test.jpg”);
//Initialize OmrEngine with Template
var engine = new OmrEngine(template);
//Set FillThreshold value
engine.Configuration.FillThreshold = .3;
//Process
var result = engine.ExtractData(new OmrImage[] { image });
//Reterieve results
Hashtable page = result.PageData[0];
//Get Collection of Keys
ICollection key = page.Keys;
//Iterate the Keys and output
foreach (string k in key)
{
Console.WriteLine(k + ": " + page[k]);
}