Chinaunix首页 | 论坛 | 博客
  • 博客访问: 398253
  • 博文数量: 159
  • 博客积分: 372
  • 博客等级: 一等列兵
  • 技术积分: 1693
  • 用 户 组: 普通用户
  • 注册时间: 2012-01-13 17:05
个人简介

致力于图形处理和移动开发。

文章分类

全部博文(159)

文章存档

2014年(77)

2013年(67)

2012年(15)

我的朋友

分类: Windows平台

2013-09-05 11:49:55

任何表单识别应用程序中都包含这2种表单:master和filled。Master forms是定义数据提取来源的空白模板。当客户填写并提交表单后,这些表单便与Master forms进行对比,然后提取数据。而filled forms 是企业中最常见最普通的表单。因此,企业在解决表单识别问题的时候,首当其冲的是要解决好Master forms的问题。

本文接下来将讨论处理大量Master forms的一些相关策略,以及如何利用快速、准确地处理表单。

利用多线程提速
如今利用多线程提速已不言而喻。LEADTOOLS Forms Recognition SDK也提供了多线程支持,当初始化AutoFormsEngine时,只需传递IOcrEngine,LEADTOOLS便会自动完成剩下的工作。
// Create an OCR Engine for each processor on the machine. This 
// allows for optimal use of thread during recognition and processing.
ocrEngines = new List();
for (int i = 0; i < Environment.ProcessorCount; i++)
{
ocrEngines.Add(OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false));
ocrEngines[i].Startup(formsCodec, null, String.Empty, String.Empty);
}
// Point repository to directory with existing master forms 
formsRepository = new DiskMasterFormsRepository(formsCodec, masterFormsFolder);
autoEngine = new AutoFormsEngine(formsRepository, ocrEngines, null, AutoFormsRecognitionManager.Default | AutoFormsRecognitionManager.Ocr, 30, 80, true);

使用条形码分类表单
条形码可能是实现表单分类最直接最快速的方法之一。条形码的最大好处就是,它可以将大量的信息打包到一个狭小的空间,例如QR码便可存储 4,296 个字母数字字符。既然简单的条形码便可识别表单,为何还要使用表单识别?乍一看,使用表单识别似乎有点小题大做了,但是 LEADTOOLS 所提供的先进的表单识别和表单处理技术有更大的好处。如果你打算通过OCR识别表单上的用户信息,你便需要进行一些特殊的步骤来准确地提取信息,如图像清理、页面对齐、校正偏差等。实现这些功能是一项复杂而艰巨的任务,需要编写数千行代码,而 LEADTOOLS SDK中提供了这些图像处理功能。
// Set up the AutoFormsEngine to use Barcodes 
autoEngine = new AutoFormsEngine(formsRepository, ocrEngines,
null, AutoFormsRecognitionManager.Barcode, 30, 70, true);
// Run the forms recognition and processing on this document
AutoFormsRunResult runResult = autoEngine.Run(document, null);
if (runResult != null)
{
// Process the recognized form and extract desired info
foreach (FormPage formPage in runResult.FormFields)
{
foreach (FormField field in formPage)
{
// Do something with the extracted field data...
}
}
}

阅读(750) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~