Free Support Forum -

How to generate optical mark recognition (OMR) template from existing image for answer recognition using Aspose.OMR API

Hello Team,

I want to generate template from existing image for recognize answer options
I am attaching my template, please help.answer sheet.PNG (26.9 KB)

I want to convert template image into template.omr (.omr) without using text file to generate .omr template.

When I want to create .omr template from existing image, following error occured.

Request processing caused an exception. Try to change the input, check files uploaded, contact support. Can’t filter nested polygons: subdiv failure 2. Reason: OpenCV(4.0.1) /home/maxx/git/OMR.Kernel/Dependencies/opencv-4.0.1/modules/imgproc/src/geometry.cpp:623: error: (-215:Assertion failed) nPPolygons > 0 in function 'filterN Error reference ID 89d095b8-cdb4-4c82-8cd3-5d8bf10ab373


Thanks for your inquiry. I am investigating the issue and will share updates with you soon.

@tilal.ahmad, Thanks for your prompt reply.

I was trying to generate template as per my need, but using prepared template, I am not able to generate template(.omr). I am evaluating your aspose OMR product and willing to purchase if you can generate exact same template from your end. I have attached here. AnswerSheet Template.jpg (88.9 KB)

Also my credit limit for free trial reached to 51, can you please increase so that I also try to generate template as per my need.


We have tested the scenario and unable to notice your reported exception. Please find the sample template generated using Aspose.OMR.Client. Hopefully it will help you to accomplish the task. (26.8 KB)

Furthermore, please note it is required that all questions on page are marked marked with OMR elements. However, if you still face the exception, then please share some more details to replicate it.


Thank you for providing template (.omr) file, but when I am processing it using Aspose.OMR.ConsoleDemo.csproj Project it gives me an error saying that “invalid amount of template ref points, expected 4 but found :0”. what is the solution for this ? (67.6 KB)

I am attaching the .omr file and TestTemplateAnswer.png file.

Is it necessary to add templatte ref points in each answersheet image ?
error.JPG (142.3 KB)


Thanks for your feedback. I am afraid I am unable to replicate your reported issue. Please find template file, template image, answer sheet and result file for your (239 Bytes) (93.3 KB)

Please try above shared template file and image, hopefully it will help you to resolve the issue. However, if the issue persists then please share your sample working project here, we will look into it and will guide you accordingly.

No, it is not mandatory for Aspose.OMR Cloud to add reference point in the image.


Thank you for the update. But i do not want to user omr.client (windows application) project to process the omr template, i can be able to process the template and get the result using omr.client windows application project. But I want to user console application that will process omr template and generate the result as per my template. I have used the console application project provided by your team on GitHub, the name of project is “Aspose.OMR.ConsoleDemo.csproj”, but when it comes to below line of code it will throw error:
// init engine and get template processor
OmrEngine engine = new OmrEngine();
TemplateProcessor templateProcessor = engine.GetTemplateProcessor(templatePath);

Also I have checked that you provided sample template and answer image for this project. That is working fine because they have 4 reference points on each corner of the page.

Please resolve this with my template without reference point using this console application project. I am attaching here that project for your reference with all files.

TestTemplateAnswer_ .zip (303.4 KB) (838.1 KB)
error.JPG (142.3 KB)

Please let me know if you have any query.

This topic has been moved to the related forum: