没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|使用教程|编辑:胡涛|2022-08-05 10:37:01.977|阅读 179 次
概述:在本文中,我们将学习如何使用 C# 开发基于 GUI 的 OMR Sheet Reader 应用程序。在本文中,我们将学习如何使用 C# 开发基于 GUI 的 OMR Sheet Reader 应用程序。在本文中,我们将学习如何使用 C# 开发基于 GUI 的 OMR Sheet Reader 应用程序。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
光学标记识别 (OMR) 是一种自动捕获和分析标记在特殊类型文档表单上的数据的过程。这种特殊类型的文件可以由人们在调查表、测试表和其他纸质文件上标记/填写。在本文中,我们将学习如何使用 C# 开发基于 GUI 的 OMR Sheet Reader 应用程序。我们的解决方案将扫描的 OMR 表图像作为本地磁盘的输入,然后识别标记,最后以CSV格式导出标记的注册号和阴影答案。完成上述步骤后,我们将拥有.NET 中的 C# 光学标记识别 (OMR) 软件。那么让我们开始吧。
我们的光学标记识别 (OMR) 软件将具有以下功能:
Aspose.OMR for .NET API 允许设计、创建和识别答题卡、测试、MCQ 试卷、测验、反馈表、调查和选票。此外,它还提供了一个图形用户界面控件,可以添加到 .NET UI 应用程序中。我们将在 .NET UI 应用程序中集成 Aspose.OMR for .NET UI 控件,以开发 OMR 扫描仪/阅读器应用程序。请下载API 的 DLL 或使用NuGet安装它。
PM> Install-Package Aspose.OMR
我们可以按照以下步骤开发基于 GUI 的 OMR 扫描仪/阅读器应用程序:
internal class DialogHelper { /// <summary> /// The filter string for the dialog that opens template images. /// </summary> private static readonly string ImageFilesFilterPrompt = "Image files |*.jpg; *.jpeg; *.png; *.gif; *.tif; *.tiff;"; /// <summary> /// The filter string for the dialog that saves recognition results /// </summary> private static readonly string DataExportFilesFilterPrompt = "Comma-Separated Values (*.csv)" + " | *.csv"; /// <summary> /// Shows Open Image file dialog. /// </summary> /// <returns>Path to selected file, or <c>null</c> if no file was selected.</returns> public static string ShowOpenImageDialog(string suggestedDir = null) { OpenFileDialog dialog = new OpenFileDialog(); return ShowDialog(dialog, ImageFilesFilterPrompt, suggestedDir); } /// <summary> /// Shows Save Recognition Results file dialog. /// </summary> /// <returns>Path to selected file, or <c>null</c> if no file was selected.</returns> public static string ShowSaveDataDialog(string suggestedName) { SaveFileDialog dialog = new SaveFileDialog(); return ShowDialog(dialog, DataExportFilesFilterPrompt, suggestedName); } /// <summary> /// Displays given dialog and returns its result as a <c>string</c>. /// </summary> /// <param name="dialog">The dialog to show.</param> /// <param name="filter">File type filter string.</param> /// <param name="suggestedDir">Suggested dialog initial directory</param> /// <param name="suggestedName">Suggested file name</param> /// <returns>Path to selected file, or <c>null</c> if no file was selected.</returns> private static string ShowDialog(FileDialog dialog, string filter, string suggestedDir = null, string suggestedName = null) { string fileName = null; dialog.Filter = filter; dialog.RestoreDirectory = true; if (suggestedName != null) { dialog.FileName = suggestedName; } if (suggestedDir != null) { dialog.InitialDirectory = suggestedDir; } bool? result = dialog.ShowDialog(); if (result == true) { fileName = dialog.FileName; } return fileName; } }
<Window x:Class="OMR_APP.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:OMR_APP" mc:Ignorable="d" Title="Aspose OMR Demo" Height="880" Width="1100"> <Grid Background="WhiteSmoke"> <Grid.RowDefinitions> <RowDefinition Height="40"></RowDefinition> <RowDefinition Height="*"></RowDefinition> </Grid.RowDefinitions> <ToolBar Grid.Row="0" Background="LightGray"> <TextBox Name="txtTemplatePath" Margin="5" Width="400" Height="30" Background="White" HorizontalContentAlignment="Center" VerticalContentAlignment="Center"> </TextBox> <Button Margin="5" Width="100" Height="30" Background="White" Content="Get control" HorizontalContentAlignment="Center" VerticalContentAlignment="Center" Click="GetButtonClicked"/> <Separator/> <Button Margin="5" Width="100" Height="30" Background="White" Content="Select Image" Click="SelectImageClicked"/> <Button Margin="5" Width="100" Height="30" Background="White" Content="Recognize Image" Click="RecognizeImageClicked"/> <Button Margin="5" Width="100" Height="30" Background="White" Content="Export Results" Click="ExportResultsClicked"/> </ToolBar> <ContentControl Grid.Row="1" x:Name="CustomContentControl" HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </Window> view rawOMR-Software-CSharp_MainWindow.xaml hosted with ❤ by GitHub 之后,替换MainWindow.xaml.cs文件中的以下内容。 /// <summary> /// Template for testing /// </summary> private static readonly string TemplateFilePath = @"C:\Files\OMR\Sheet.omr"; /// <summary> /// Path to the license Aspose.OMR.NET.lic file /// </summary> private static readonly string LicensePath = @""; private CorrectionControl control; public MainWindow() { InitializeComponent(); // Set and show template file path txtTemplatePath.Text = TemplateFilePath; // Set license, provide License file Path and uncomment to test full results //License lic = new License(); //lic.SetLicense(LicensePath); } public string UserImagePath { get; set; } public string DataFolderPath { get; set; } /// <summary> /// Loads and displays CorrectionControl /// </summary> private void GetButtonClicked(object sender, RoutedEventArgs e) { string path = txtTemplatePath.Text; try { OmrEngine engine = new OmrEngine(); TemplateProcessor processor = engine.GetTemplateProcessor(path); control = engine.GetCorrectionControl(processor); CustomContentControl.Content = control; control.Initialize(); } catch (Exception ex) { MessageBox.Show(ex.Message,"Exception"); } } /// <summary> /// Select and display image /// </summary> private void SelectImageClicked(object sender, RoutedEventArgs e) { if (control == null) { return; } string imagePath = DialogHelper.ShowOpenImageDialog(this.DataFolderPath); if (string.IsNullOrEmpty(imagePath)) { return; } this.UserImagePath = imagePath; control.LoadAndDisplayImage(imagePath); } /// <summary> /// Recognize loaded image /// </summary> private void RecognizeImageClicked(object sender, RoutedEventArgs e) { if (control == null) { return; } control.RecognizeImage(); } /// <summary> /// Export results to CSV /// </summary> private void ExportResultsClicked(object sender, RoutedEventArgs e) { if (control == null) { return; } string imageName = Path.GetFileNameWithoutExtension(this.UserImagePath); string path = DialogHelper.ShowSaveDataDialog(imageName); if (string.IsNullOrEmpty(path)) { return; } control.ExportResults(path); MessageBox.Show("The exported resultant CSV file can be found here : " + path, "Operation Successful"); }
以下是我们刚刚创建的 OMR Scanner/Reader 应用程序的演示。
在本文中,我们学习了如何
欢迎下载|体验更多Aspose产品
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com
本文主要介绍如何使用DevExpress WPF Grid控件获取节点,欢迎下载最新版组件体验!
通过将绘图转换为 Photoshop 格式,您可以轻松编辑和增强设计。Aspose.CAD是一款功能强大的 SDK,可无缝实现此转换。借助Aspose.CAD for Python via .NET,开发人员可以自动化转换过程,从而节省时间并减少错误。本博客将指导您如何使用 Python 将绘图转换为 Photoshop。
本教程主要为大家介绍DevExpress WinForms Tile(平铺)视图的基础知识,欢迎下载最新版组件体验!
将DGN文件转换为PDF对许多行业至关重要,包括工程和建筑行业,使用Aspose.CAD ,开发人员可以高效地自动化此过程。
Aspose.OMR for .NET是一种光学标记识别API,可从多种图像格式中识别光学标记。
Aspose.Words for .NET无需Microsoft Word也可在任何平台上满足Word文档的一切操作需求。
Spire.Office for .NET专业的.NET Office套件,涵盖office文档创建、编辑、转换、管理和OCR内容识别等操作
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@evget.com
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
慧都科技 版权所有 Copyright 2003-
2025 渝ICP备12000582号-13 渝公网安备
50010702500608号