We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error: "Failed to find matching between the template and the image!" from iPhone JPG

RecognizeImage(imagePath) results in “Failed to find matching between the template and the image!” errors when the source file is a JPG from an iPhone. However, if I open the file in MS Paint (without editing) and Save As PNG, then I don’t get the error.

As a workaround, I’ve tried converting JPGs in code using bitmap.Save(path, ImageFormat.Png) but the problem remains.

The failure rate Aspose OMR from pictures taken with an iPhone 12 Pro Max even with good lighting and positioned carefully is very high and I’m wondering if there’s steps I can take to mitigate this problem and would like clarification on why Save As PNG seems to have a lower failure rate. Obviously I cannot ask our users to edit their photos in MS Paint before uploading to process their OMR, so I’m looking for assistance on how we can successfully use your product. Any guidance would be appreciated.

Attached are the OMR and PDF files generated by the template.
Template999.zip (818.5 KB)

Thanks!

@Shonn

Could you please share the JPG images as well that are not being accepted by the API? Also, please share the complete sample code snippet that you have used at your end and faced the exception. We will replicate it in our environment and address it accordingly.

IMG_3628.JPG (613.0 KB)

OmrEngine engine = new OmrEngine();
TemplateProcessor templateProcessor = engine.GetTemplateProcessor(templatePath);
string json = templateProcessor.RecognizeImage(imagePath).GetJson();

@Shonn

Are you using 22.2 version of the API? We tested using this version and did not notice any Exception while using the image and template shared by you. Below is the JSON string which we obtained during testing:

{"RecognitionResults":[{"ElementName":"Question1","Value":"1"},{"ElementName":"Question2","Value":"1"},{"ElementName":"Question3","Value":"3"}]}

That is so weird. Yes, same version.

Type.GetType("Aspose.OMR.Api.OmrEngine").Assembly.FullName

Prints the following:

"Aspose.OMR, Version=22.2.0.0, Culture=neutral, PublicKeyToken=716fcc553a201e56"

@Shonn

Please try to run the same code snippet with same file on another system and in case issue still persists, please share the complete environment details with us so that we can try to replicate the issue in our environment and address it accordingly.

IMG_3628.JPG (613.0 KB)

Testing this image on another system got the same error.

However, something very unusual…when I download the same file using the link here in your support forum which I posted above, then it works. I have no idea why. Maybe one of your developers has an idea???

If not, consider this issue closed.

Thank you!

@Shonn

This behavior seems strange. However, we will surely try to investigate it and will let you know in case we find some particular reason for this.

@Shonn

Can you please try using 22.3 version of the API and let us know in case you still face any issue?