using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Aspose.OMR;
using System.Collections;
namespace OMRRnD
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
ProcessImage();
}
public void ProcessImage()
{
/*
string templateFile = "sample-template.amr ";
string imageFile = "sample-image.png";
// do not forget to set the license for OCR in case TextOcrElement is used
Aspose.OCR.License licenseOcr = new Aspose.OCR.License();
licenseOcr.SetLicense("Aspose.Total.lic");
Aspose.OMR.License licenseOmr = new Aspose.OMR.License();
licenseOmr.SetLicense("Aspose.Total.lic");
// Loading the template
OmrTemplate template = OmrTemplate.Load(templateFile);
// Set resource for TextOcrElement
TextOcrElement.Resource = "3GNResourcesFullWithVerdanaAndEsFr.zip";
// Create an instance of TextOcrElement and initialize it by specifying the location of text and its size in mm
TextOcrElement textElement = new TextOcrElement("OCR Text", new PointF(23.6f, 15.5f), new SizeF(14.6f, 4.7f));
// Add the TextOcrElement to the page element collection
template.Pages[0].Elements.Add(textElement);
// Create an instance of OmrImage and load the image using file path
OmrImage image = OmrImage.Load(imageFile);
// Create an instance of OmrEngine and load the template using file path
OmrEngine engine = new OmrEngine(template);
// Extract OMR data and store the results in an instance of OmrProcessingResults
OmrProcessingResult result = engine.ExtractData(new OmrImage[] { image });
// Get all page data into an instance of Hashtable
Hashtable[] pages = result.PageData;
// Loop over all the pages
foreach (Hashtable page in pages)
{
// Display key and value
foreach (string key in page.Keys)
{
Console.WriteLine("key: " + key + ": " + "value: " + page[key]);
}
}*/
//Load template file
var path = @"E:\Developement\OMR\Template\";
var pathImage = @"E:\Developement\OMR\Application\OMRRnD\ScannedImage\";
OmrTemplate template = OmrTemplate.Load(path + "TestTemplate.amr");
//Load the image to be analyzed
OmrImage image = OmrImage.Load(pathImage + "Result.png");
// 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.ReadKey();
}
}
}
*******************************************
I am using above code for trial virsion but not able to extract data form OMR image file..I use image which you use in ur sample