OMR 模板可通過光學標記識別 (OMR) 軟件或 API 讀取。 OMR 軟件讀取人們在調查、測試和其他紙質文檔上標記/填寫的信息。我們可以通過編程方式從文本標記輕鬆生成 OMR 調查、測驗或答題卡。在本文中,我們將學習如何使用 Java 創建 OMR 調查或答題紙。
本文應涵蓋以下主題:
用於創建 OMR 調查或答題紙的 Java API
為了從文本標記創建 OMR 模板,我們將使用 Aspose.OMR for Java API。它允許設計、創建和識別答題卡、測試、MCQ 試卷、測驗、反饋表、調查和投票。請下載 API 的 JAR 或在基於 Maven 的 Java 應用程序中添加以下 pom.xml 配置。
<repository>
<id>AsposeJavaAPI</id>
<name>Aspose Java API</name>
<url>http://repository.aspose.com/repo/</url>
</repository>
<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-omr</artifactId>
<version>19.12</version>
</dependency>
使用 Java 從文本標記創建 OMR 調查表
我們可以按照以下步驟從文本標記創建調查表:
- 首先,創建 OmrEngine 類的一個實例。
- 接下來,使用文本標記文件路徑作為參數調用 GenerateTemplate 方法。
- 之後,將結果作為 GenerationResult 類的對象獲取。
- 最後調用Save方法保存模板圖片和OMR模板。它以本地磁盤文件夾的路徑和模板的名稱作為參數。
以下代碼示例演示瞭如何使用 Java 從文本標記創建 OMR 調查模板。
// 此代碼示例演示如何從文本標記生成調查圖像和 OMR。
// 帶有模板標記的文本文件的路徑
String markupPath = "D:\\Files\\OMR\\SimpleSurvey.txt";
// 初始化 OMR 引擎
OmrEngine engine = new OmrEngine();
// 生成模板
GenerationResult res = engine.generateTemplate(markupPath);
// 保存到本地磁盤
res.save("D:\\Files\\OMR\\", "SimpleSurvey");
我們在上面提到的代碼示例中使用了以下文本標記。
?text=Welcome to Sample Survey
?text=March 30, 2022
#What is Aspose.OMR main function?
() OCR () Capture human-marked data
() There is no main function () Enhance images
#Can Aspose.OMR process not only scans, but also photos?
() 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%
#Does Aspose.OMR support bubbles mapping to any key names?
() No () Partially () Yes, any key names
#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)
使用 Java 從文本標記創建 OMR 測試
我們可以按照前面提到的步驟創建測驗或測試。但是,我們只需要為此目的使用以下文本標記。
?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 not only scans, but also photos?
() 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=Sign________________________________
使用 Java 從文本標記生成 OMR 答題紙
我們可以按照前面提到的步驟創建一個可以打印的 OMR 答題紙。但是,我們只需要為此目的使用以下文本標記。
?answer_sheet=MainQuestions
elements_count=200
columns_count=5
獲得免費許可證
您可以 獲得免費的臨時許可證 來試用該庫,而沒有評估限制。
結論
在本文中,我們學習瞭如何從文本標記創建 OMR 調查模板並生成調查圖像。我們還了解瞭如何以編程方式從文本標記生成測驗和答題卡。此外,您可以使用 文檔 了解更多關於 Aspose.OMR for Java API 的信息。如有任何歧義,請隨時在 論壇 上與我們聯繫。