Template element dimensions are out of image bounds

getting error on this point

// Extract data. This template has only one page.
OmrProcessingResult result = engine.ExtractData(new OmrImage[] { image });

error:“Template element dimensions are out of image bounds.”

i am using ur sample question.amr and answer.jpg file.

@urharsh,

Please forward us the sample template and the sample scanned answer sheet. We will look into it and update you about our findings.

answers.jpg (590.1 KB)

pl find 2 files from Aspose.OCR-for-.NET-master\Examples\Data\OCR\ answer.jpg,question.amr here:-

@urharsh,

We have tested the OMR template with answer image. We are able to get the results using following code snippet. OMR template and answer sheet image is attached for your reference.

CODE:

        string templatePath = @"\Input\questions.amr";
        string imagePath = @"\Input\answers.jpg";

        OmrTemplate template = OmrTemplate.Load(templatePath);
        OmrImage image = OmrImage.Load(imagePath);

        OmrEngine engine = new OmrEngine(template);
        OmrProcessingResult result = engine.ExtractData(new OmrImage[] { image });

        Hashtable OmrResult = result.PageData[0];
        ICollection key = OmrResult.Keys;
        foreach (string k in key)
        {
            Console.WriteLine(k + ": " + OmrResult[k]);
        }

I have same code Pl. look:

string dataDir = Server.MapPath("");
            OmrTemplate template = OmrTemplate.Load(dataDir + "/answers_OMR_template.amr");
            OmrImage image = OmrImage.Load(dataDir + "/answers.jpg");
            //image.AutoDetectResolution = true;
            OmrEngine engine = new OmrEngine(template);
            OmrProcessingResult result = engine.ExtractData(new OmrImage[] { image });
            Hashtable OmrResult = result.PageData[0];
            ICollection key = OmrResult.Keys;
            foreach (string k in key)
            {
                Response.Write(k + ": " + OmrResult[k]);
                
            }

  1. when we uncomment
 //image.AutoDetectResolution = true;

it works fine otherwise it says "Template element dimensions are out of image bounds ". why?

Note:- i am doing in asp.net webapplication.

  1. i am getting result “element2: Aelement1: Delement3:”. not getting because answers shit contains
    lots of data.
  2. how can i create .amr file ?

@urharsh,

We have evaluated the code snippet shared by you. It is working fine. We have used latest version of Aspose.OCR. Please forward us a sample Asp.Net project demonstrating the issue. We will evaluate it at our end and update you about our findings. Furthermore you can find the details on how to create an OMR template on the link: Creating and Saving Templates.