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

Free Support Forum - aspose.com

OCR.Net support

so another question to Babur Raza. as i will start scanning papers how would i identify that which template will be used for which scanned paper?

Hi Asad,

Thank you for contacting Aspose support.

If you wish to automate the process of scanned answer sheet sorting/identification, I would suggest you to print a special marker on each sheet for this purpose.

Let me explain the concept for better elaboration. In case you have 2 types of answer sheets (based on the number of question) you put a marker having 2 choices (let say, A & B) representing each type on every answer sheet. While printing the blank answer sheets, the aforesaid marker will be filled by the printer itself, marking it either A or B. At the time of processing, you will first process each image with a special template just to read this marker, and based on the outcome you can make a decision at runtime against which template a particular answer sheet should be processed.

Please note, the collective processing time will be doubled because you will be processing each image twice. In case you have performance constrains, I would suggest you to manually sort the images into batches at the time of scanning. Please feel free to write back if you have any ambiguity or further questions.

1 - how much time it will take to process an image?

2 - What should be the size of an image?
3 - What should be resolution of the image?
4 - DPI ?

Hi Asad,

Thank you for writing back.

I have performed a few tests on different file formats having different file sizes with constant 200 DPI resolution whereas the input template has 20 grid elements/questions to be recognized. The BMP image format having 10 MB size took the least time (105 milliseconds) to recognize all 20 markers. Jpeg image of 318 KB file size took 166 milliseconds for the same process. Tiff image of 2.7 MB took 463 milliseconds.

Here are the answers to your questions in the same sequence.

  • It depends on the image format & the number of elements in the template. As per my observation BMP images are most favorable as it took the least time (105 milliseconds) to recognize 20 elements from the attached template. Moreover, if you increase the number of elements the time to process the image will slightly increase.
  • Apparently, image format is the most concerned factor regardless of the file size therefore the image size may not affect the OMR process or execution time at large.
  • Resolution should be 200 DPI at least, however, it suggested to scan the documents at 300 DPI.
  • Same as above.

Please feel free to write back in case you have further questions.


string[] imagesFiles = Directory.GetFiles(MyDir + “/paper/”);
var watch = new System.Diagnostics.Stopwatch();

//Load template file
OmrTemplate template = OmrTemplate.Load(MyDir + “template-20Q.amr”);
foreach (var imagesFile in imagesFiles)
FileInfo fileInfo = new FileInfo(imagesFile);

//Load the image to be analyzed
OmrImage image = OmrImage.Load(imagesFile);
// Instantiate the recognition engine for the template
OmrEngine engine = new OmrEngine(template);
// Extract data. This template has only one page.
OmrProcessingResult result = engine.ExtractData(new OmrImage[] { image });
//Load actual result from
Hashtable OmrResult = result.PageData[0];
//Get Collection of Keys
ICollection key = OmrResult.Keys;
foreach (string k in key)
 Console.WriteLine(k + ": " + OmrResult[k]);
Console.WriteLine("Processed " + imagesFile + " in " + watch.ElapsedMilliseconds + “miliseconds”);

i want to use ur code in a seperate thread as the directory will receive a file using filewatcher i will process that file in a separate thread. Do u think, cross-thread type exception could occur or not???

Hi Asad,

As far as I understood your scenario, you will have two threads. One thread will be feeding in the images to be processed where as other will perform OMR operation on the fed image. I believe there won’t be any problems regarding the cross-thread execution. In case you stumble upon some error, please post your sample application for further investigation.

Thanks a lot. so please give the urls for 1 month trial version for OCR.Net.

Hi again,

Please follow the instructions provided on the below linked page and submit a request for 30 day temporary license to test the Aspose.OCR for .NET API without any limitations.

Once the license is received via an email, you can set the license at the start of your application using the following statements.


var omrlicense = new Aspose.OMR.License();
omrlicense.SetLicense(@“file path location to the .lic file”);

Please feel free to contact us back if you need our further assistance with Aspose APIs.