
Overview
Are you searching for an efficient and feature-packed Java OMR library? Do you wish to identify optical marks in scanned images? Explore Aspose.OMR for Java, a Java class library designed for Optical Mark Recognition SDK solutions in Java-based applications. Here’s a quick overview of the features of this Java API, demonstrating how it can be used to recognize optical marks across various image formats and obtain human-marked data from surveys, questionnaires, or tests featuring MCQs.
Dynamically Create OMR Template using Java OMR Library
Aspose.OMR for Java offers a comprehensive suite of features from the creation of OMR templates to recognizing optical marks for data capture. This Optical Mark Recognition SDK supports the generation of OMR template files or images from simple text markups. To generate the template, you can pass the text markup to the API, enabling automatic template creation. Below is a sample text markup for an OMR template:
?text=Name__________________________________ Date____________
?grid=ID
sections_count=8
#What is Aspose.OMR main function?
() OCR () Capture human-marked data
() There is no main function () Enhance images
#Can Aspose.OMR process photos as well?
() Yes, indeed! () No
#Aspose.OMR is available on any platform, because it is:
() Cross-platform code () Cloud service
#Aspose.OMR works with any kind of OMR forms: tests, exams, questionnaires, surveys, etc.
() Yes, indeed! () No
#Excellent recognition results can be achieved only for filled bubbles at least for:
() 40% () 60% () 75% () 98%
#Do you have to mark up every question on the page?
(Yes) Yes, that will help a lot! (No) No
#Rate your preference from 0 to 9 with "0" being preference towards performance
and "9" being preference towards flexibility.
(0) (1) (2) (3) (4) (5) (6) (7) (8) (9)
#I found aspose omr to be a useful tool. (5 - strongly agree, 1 - strongly disagree)
(5) (4) (3) (2) (1)
?text= Answer sheet section
?answer_sheet=MainQuestions
elements_count=10
columns_count=5
?text=Sign________________________________
You can save this text markup in a text file with a .txt extension. Once done, beginning template generation follows these steps:
- Create an OmrEngine object.
- Call OmrEngine.generateTemplate() method that accepts the markup text file’s path.
- Save the template using GenerationResult.save method.
Here is how a sample code snippet in Java shows template generation from text markup.
Output
Optical Mark Recognition (OMR) in Images using Java
To perform Optical Mark Recognition (OMR) on images, you only need two components: the prepared OMR template (.omr) and the user-filled forms or sheets you wish to analyze. With the support of the Optical Mark Recognition SDK, the API facilitates OMR for various image formats, including:
The steps to perform OMR on images are as follows:
- Create OmrEngine object.
- Create TemplateProcessor object and initialize it with the OMR template’s path.
- Recognize images using TemplateProcessor.recognizeImage() method and get results in CSV or JSON format.
Presented below is a code sample demonstrating how to recognize optical marks in images using Java.
Using a Custom Recognition Threshold for OMR
You can also fine-tune the OMR results by defining a custom threshold between 0 to 100 when using the Optical Mark Recognition SDK. Increasing the threshold makes the API more strict in recognizing the answers. The threshold values can be set in the TemplateProcessor.recognizeImage() method as the second parameter, as shown in the following Java code sample.
.
Recalculating the OMR Results using Optical Mark Recognition SDK
In some instances, you might want to recalculate the OMR results using different threshold values. Instead of repeatedly invoking TemplateProcessor.recognizeImage(), you can enhance image processing efficiency by configuring the API for automatic recalculation with the TemplateProcessor.recalculate() method provided by the Optical Mark Recognition SDK. The following code sample demonstrates how to implement the recalculation of OMR results.
If you have any inquiries or require assistance regarding our Java OMR library, feel free to reach out to us on our forum.