DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Curious about the future of data-driven systems? Join our Data Engineering roundtable and learn how to build scalable data platforms.

Data Engineering: The industry has come a long way from organizing unstructured data to adopting today's modern data pipelines. See how.

Threat Detection: Learn core practices for managing security risks and vulnerabilities in your organization — don't regret those threats!

Managing API integrations: Assess your use case and needs — plus learn patterns for the design, build, and maintenance of your integrations.

Related

  • Using VB.NET To Check for Proxy and VPN With IP2Location.io Geolocation API
  • OneStream Fast Data Extracts APIs
  • Reversing an Array: An Exploration of Array Manipulation
  • Setup ActiveMQ Artemis on Windows

Trending

  • Platform Engineering: A Strategic Response to the Growing Complexity of Modern Software Architectures
  • What the CrowdStrike Crash Exposed About the Future of Software Testing
  • AI-Powered Flashcard Application With Next.js, Clerk, Firebase, Material UI, and LLaMA 3.1
  • Java 23: What Developers Need to Know
  1. DZone
  2. Data Engineering
  3. Data
  4. How to Extract OMR Data from Scanned Images inside C# & VB.NET Apps

How to Extract OMR Data from Scanned Images inside C# & VB.NET Apps

By 
David Zondray user avatar
David Zondray
·
Jun. 03, 15 · Code Snippet
Likes (0)
Comment
Save
Tweet
Share
11.7K Views

Join the DZone community and get the full member experience.

Join For Free

This technical tip shows how to extract OMR data from a scanned image inside .NET Applications. Developers can use the Aspose.OMR namespace to extract data entered into OMR (Optical Mark Recognition) forms, such as consumer surveys, assessment sheets, or lottery tickets. This article describes how to extract data from a scanned page using a OMR template created with OMR Template Editor tool.   The Aspose.Omr namespace can be used to recognize and extract different elements from a scanned image. A template is required that contains graphical mapping of elements to be recognized from the scanned images. This template document is loaded using OmrTemplate. Pages with human marked data like surveys or tests are scanned, and the images loaded using the OmrImage class. A recognition engine (OmrEngine) is required for the template and can be initiated by using the current template as an argument. After the template has been set in the engine, the data is extracted from the scanned image using the OmrEngine class' ExtractData function.  Below are the steps to extract OMR data from a scanned image:

  • Load the template using OmrTemplate.
  • Load the scanned image into OmrImage.
  • Instantiate the recognition engine: OmrEngine for the template.
  • Extract data and save to OmrProcessingResult.
//The sample code below shows how to extract OMR data from a scanned image

//[C#]

//Load template file
OmrTemplate template = OmrTemplate.Load(MyDir + "Grids.amr");

//Load the image to be analyzed
OmrImage image = OmrImage.Load(MyDir + "Grids-filled-scan.jpg");

// 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();

//[VB.NET]
 
'Load template file
Dim template As OmrTemplate = OmrTemplate.Load(myDir + "Grids.amr")

'Load the image to be analyzed
Dim image As OmrImage = OmrImage.Load(MyDir + "Grids-filled-scan.jpg")

'Instantiate the recognition engine for the template
Dim engine As OmrEngine = New OmrEngine(template)

'Extract data. This template has only one page.
Dim result As OmrProcessingResult = engine.ExtractData(New OmrImage() {image})

'Load actual result from
Dim OmrResult As Hashtable = result.PageData(0)

'Get collection of keys
Dim Key As ICollection = OmrResult.Keys

For Each k As String In Key
     Console.WriteLine(k + ": " + OmrResult(Key))
Next
Console.ReadKey()
Data (computing) Extract VB.NET

Opinions expressed by DZone contributors are their own.

Related

  • Using VB.NET To Check for Proxy and VPN With IP2Location.io Geolocation API
  • OneStream Fast Data Extracts APIs
  • Reversing an Array: An Exploration of Array Manipulation
  • Setup ActiveMQ Artemis on Windows

Partner Resources


Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends: