Generate template from existing image to recognize answer options - Aspose.OMR for .NET

Hello Team,

I want to generate template from existing image for recognize answer options
I am attaching my template, please help.

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

answer sheet.PNG (26.9 KB)

@bvaidya

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.

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.
AnswerSheet Template.jpg (88.9 KB)

@bvaidya

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.

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.
User.zip (26.8 KB)

@tilal.ahmad,

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 ?

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)
TestTemplateAnswer.zip (67.6 KB)
error.JPG (142 KB)

@bvaidya

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 reference.

Please try the 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.
gravatar.png (52.0 KB)
TestTemplateAnswer.zip (239 Bytes)
TestTemplate.zip (93.3 KB)

@tilal.ahmad

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)
Aspose.OMR.ConsoleDemo.zip (838.1 KB)
error.JPG (142.3 KB)

Please let me know if you have any query.
error.JPG (142 KB)
TestTemplateAnswer_ .zip (303 KB)
Aspose.OMR.ConsoleDemo.zip (838 KB)

@bvaidya

Thanks for sharing additional information and sample project. It seems you are using Aspose.OMR for .NET downloadable API instead of Aspose.OMR Cloud REST API, so I have moved your query to related forum. We will look into the issue and will guide you accordingly.

Furthermore, please note Aspose.OMR Cloud does not need reference points in the image, but reference points are necessary for the Aspose.OMR for .NET downloadable API.

@bvaidya

Since you are using Aspose.OMR for .NET and your requirements are also related to it, we have already addressed your concerns in other thread created by you. In case you have concerns different than that, please feel free to share.

@asad.ali

thankyou for your reply.

I need to scan omr sheet with 4 reference points on each corner of the omr sheet, I am not able to scan it with the solution you provided on the internet.

Can you please help to to solve this issue?
I am attaching here all omr sheet, image and project that I want to scan it.

can you please help me to fix this issue?

also i want to know the pricing / license of aspose.omr downloadable API and aspose.omr cloud API with number of omr sheet scan and what is the cost?
I really need to evaluate this product and willing to purchase in near future.

Please help me.

Aspose.OMR.ConsoleDemo.zip (838.1 KB)
TestTemplateAnswer_ .zip (303.4 KB)

@apd.vdm

Could you please confirm if you are also facing following exception in your environment. We will further proceed to assist you accordingly. Furthermore, please find all pricing information over Pricing page of our website.

ExceptionOMR.png (3.8 KB)

@asad.ali

Yes we are facing same error in our environment, can we schedule phone call, it is very urgent to finalize your product.

@bvaidya

We have logged an issue as OMR-420 in our issue tracking system to further investigate the reasons behind. We will definitely look into details of the issue and keep you posted with the status of its correction. Please be patient and spare us little time.

We are sorry for the inconvenience.

Please note that we appreciate providing support via our forum. You can post your inquiries in case you have more. If you want to inquire something from sale department, please visit contact page over our website.

1 Like

@bvaidya

We have investigated the earlier logged ticket and as per our findings:

Currently Aspose.OMR for .NET uses reference points in order to properly work. Although black rectangles were added to the image, it is also required to add ReferencePoint elements to the template file (.omr). We have edited the provided template and attached it so it should work now. In the attached archive there are 3 files:

  • edited .omr file with added reference points
  • template image
  • image for the recognition. Our console demo should properly work with these files.

Currently adding reference points can be done manually, but in the new release next week we will introduce Aspose.OMR Client improvement that will automatically add reference points to your image and template file. OMR Client will be free and available on GitHub, and you can only use it once to prepare the template file (.omr). Adding reference points will be done in one click.

However, Aspose.OMR for .NET focuses more on standard A4 format papers, so for attached example, which is not standard size, it may still require manual edit of the .omr file.

DemoData.zip (158.4 KB)

1 Like

@asad.ali
Thank you for your reply, I have tested with the files you provided to us.

I have verified the result, it only processing only first five questions, not all 12 questions processed by the code. can you please help to solve this?
kindly find the images for your reference.
Not-recognized, all questions omr.JPG (155.6 KB)
Not-recognized, all questions omr.JPG (155.6 KB)
Not-recognized, all questions.JPG (129.8 KB)
only 5 questions processed from the image…JPG (154.1 KB)

Also, when I am running aspose.omr.client.exe, and validating template that you have provided, the application is going to closed and below error coming in event viewer.

Application: Aspose.OMR.Client.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.Runtime.Serialization.SerializationException
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(System.Runtime.Serialization.XmlReaderDelegator, System.String, System.String, System.Type, System.Runtime.Serialization.DataContract ByRef)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(System.Runtime.Serialization.XmlReaderDelegator, Int32, System.RuntimeTypeHandle, System.String, System.String)
at DynamicClass.ReadArrayOfOmrElementFromJson(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson, System.Xml.XmlDictionaryString, System.Xml.XmlDictionaryString, System.Runtime.Serialization.CollectionDataContract)
at System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson)
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson)
at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(System.Runtime.Serialization.DataContract, System.Runtime.Serialization.XmlReaderDelegator)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(System.Runtime.Serialization.XmlReaderDelegator, System.String, System.String, System.Type, System.Runtime.Serialization.DataContract ByRef)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(System.Runtime.Serialization.XmlReaderDelegator, Int32, System.RuntimeTypeHandle, System.String, System.String)
at DynamicClass.ReadOmrPageFromJson(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson, System.Xml.XmlDictionaryString, System.Xml.XmlDictionaryString[])
at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson)
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson)
at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(System.Runtime.Serialization.DataContract, System.Runtime.Serialization.XmlReaderDelegator)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(System.Runtime.Serialization.XmlReaderDelegator, System.String, System.String, System.Type, System.Runtime.Serialization.DataContract ByRef)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(System.Runtime.Serialization.XmlReaderDelegator, Int32, System.RuntimeTypeHandle, System.String, System.String)
at DynamicClass.ReadArrayOfOmrPageFromJson(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson, System.Xml.XmlDictionaryString, System.Xml.XmlDictionaryString, System.Runtime.Serialization.CollectionDataContract)
at System.Runtime.Serialization.Json.JsonCollectionDataContract.ReadJsonValueCore(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson)
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson)
at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(System.Runtime.Serialization.DataContract, System.Runtime.Serialization.XmlReaderDelegator)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(System.Runtime.Serialization.XmlReaderDelegator, System.String, System.String, System.Type, System.Runtime.Serialization.DataContract ByRef)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(System.Runtime.Serialization.XmlReaderDelegator, Int32, System.RuntimeTypeHandle, System.String, System.String)
at DynamicClass.ReadOmrTemplateFromJson(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson, System.Xml.XmlDictionaryString, System.Xml.XmlDictionaryString[])
at System.Runtime.Serialization.Json.JsonClassDataContract.ReadJsonValueCore(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson)
at System.Runtime.Serialization.Json.JsonDataContract.ReadJsonValue(System.Runtime.Serialization.XmlReaderDelegator, System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson)
at System.Runtime.Serialization.Json.XmlObjectSerializerReadContextComplexJson.ReadDataContractValue(System.Runtime.Serialization.DataContract, System.Runtime.Serialization.XmlReaderDelegator)
at System.Runtime.Serialization.XmlObjectSerializerReadContext.InternalDeserialize(System.Runtime.Serialization.XmlReaderDelegator, System.String, System.String, System.Type, System.Runtime.Serialization.DataContract ByRef)
at System.Runtime.Serialization.XmlObjectSerializerReadContextComplex.InternalDeserialize(System.Runtime.Serialization.XmlReaderDelegator, System.Type, System.Runtime.Serialization.DataContract, System.String, System.String)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.InternalReadObject(System.Runtime.Serialization.XmlReaderDelegator, Boolean)
at System.Runtime.Serialization.XmlObjectSerializer.InternalReadObject(System.Runtime.Serialization.XmlReaderDelegator, Boolean, System.Runtime.Serialization.DataContractResolver)
at System.Runtime.Serialization.XmlObjectSerializer.ReadObjectHandleExceptions(System.Runtime.Serialization.XmlReaderDelegator, Boolean, System.Runtime.Serialization.DataContractResolver)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(System.Xml.XmlDictionaryReader)
at System.Runtime.Serialization.Json.DataContractJsonSerializer.ReadObject(System.IO.Stream)
at Aspose.OMR.Client.TemplateSerializer.JsonToTemplate(System.String)
at Aspose.OMR.Client.ViewModels.MainViewModel.LoadTemplateFromFile(System.String)
at Aspose.OMR.Client.ViewModels.MainViewModel.OnLoadTemplate()
at Aspose.OMR.Client.ViewModels.MainViewModel.b__150_1(System.Object)
at Aspose.OMR.Client.Utility.RelayCommand.Execute(System.Object)
at MS.Internal.Commands.CommandHelpers.CriticalExecuteCommandSource(System.Windows.Input.ICommandSource, Boolean)
at System.Windows.Controls.Primitives.ButtonBase.OnClick()
at System.Windows.Controls.Button.OnClick()
at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(System.Windows.Input.MouseButtonEventArgs)
at System.Windows.UIElement.OnMouseLeftButtonUpThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject, System.Windows.RoutedEventArgs, System.Windows.RoutedEvent)
at System.Windows.UIElement.OnMouseUpThunk(System.Object, System.Windows.Input.MouseButtonEventArgs)
at System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventArgs.InvokeHandler(System.Delegate, System.Object)
at System.Windows.RoutedEventHandlerInfo.InvokeHandler(System.Object, System.Windows.RoutedEventArgs)
at System.Windows.EventRoute.InvokeHandlersImpl(System.Object, System.Windows.RoutedEventArgs, Boolean)
at System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject, System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs)
at System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs, Boolean)
at System.Windows.Input.InputManager.ProcessStagingArea()
at System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs)
at System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport)
at System.Windows.Interop.HwndMouseInputProvider.ReportInput(IntPtr, System.Windows.Input.InputMode, Int32, System.Windows.Input.RawMouseActions, Int32, Int32, Int32)
at System.Windows.Interop.HwndMouseInputProvider.FilterMessage(IntPtr, MS.Internal.Interop.WindowMessage, IntPtr, IntPtr, Boolean ByRef)
at System.Windows.Interop.HwndSource.InputFilterMessage(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndWrapper.WndProc(IntPtr, Int32, IntPtr, IntPtr, Boolean ByRef)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(System.Object)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegate, System.Object, Int32)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(System.Object, System.Delegate, System.Object, Int32, System.Delegate)
at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading.DispatcherPriority, System.TimeSpan, System.Delegate, System.Object, Int32)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr, Int32, IntPtr, IntPtr)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(System.Windows.Interop.MSG ByRef)
at System.Windows.Threading.Dispatcher.PushFrameImpl(System.Windows.Threading.DispatcherFrame)
at System.Windows.Threading.Dispatcher.PushFrame(System.Windows.Threading.DispatcherFrame)
at System.Windows.Application.RunDispatcher(System.Object)
at System.Windows.Application.RunInternal(System.Windows.Window)
at System.Windows.Application.Run(System.Windows.Window)
at Aspose.OMR.Client.App.Main()

@bvaidya

This limitation is due to trial version limitation. In order to test the API without any limitation, please use a valid license. You can apply for a 30-days free temporary license from our website and use it to evaluate the API.

Would you please share the link from where you found the .exe. We will further investigate it and share our feedback accordingly.

1 Like

@asad.ali thank you for your reply, but we want to use downloadable dll files to process OMR sheet, and we do not want to user API.
I requested license and they provided me temp license, but when I am trying to configured it with “Aspose.omr.demos” console application, it is not working. Please find attached image.trial license not applied to aspose.omr.demos console application…JPG (154.9 KB)

please help me to resolve this.

I also try to contact sales team via, chat and skype, but no response from them.
Can you please provide my contact number to them +91-8511859845 ( Brijesh Vaidya) to contact me for buying your product.

Thanks,
Brijesh Vaidya

@bvaidya

Could you please provide us your license file in a private message so that we can test it in our environment. You can send a private message by clicking over username and pressing blue Message button.

Furthermore, you may please post your sale related inquiries or question in Aspose.Purchase category where you will be assisted accordingly.

@bvaidya

Thanks for sharing requested files in private message.

We noticed that the license you are trying with is for Aspose.OCR for .NET. Which is why you are unable to set it and obtain desired results. We have again tested the scenario with valid license using TestTemplate3.omr Template and results were fine. Please check attached screenshot.

Recognizd.png (67.1 KB)

Could you please apply for correct temporary license i.e. Aspose.OMR for .NET and try again in your environment. In case you still face any issue, please feel free to let us know.

@asad.ali

Thank you for the update, we have capture images from the phone and then try to scan, but it is not recognized images and the answers are not getting from the solution.
Please help us to process mobile phone scan images to process omr and get the result.

I have attached images for your reference.

5b8fe9ff-8a99-4561-a7d1-d1cdf7c6e9c0.jpg (180.2 KB)
87117a7f-d0fa-425c-98bf-9362524eca1e.jpg (303.9 KB)

Is it possible to add four square reference point under the border ? can you please create template like that and send us, so we can try with that template and mobile scanned images to check, how it is recognized the answers ?

I have attached images for your reference.

And if the reference points could be changed to Black Circles instead of Black Squares?

TestTemplate2 - empty - with square under border.PNG (30.9 KB)