LEADTOOLS使用教程:自動識別和處理表格
LEADTOOLS (Lead Technology)由Moe Daher and Rich Little創建于1990年,其總部設在北卡羅來納州夏洛特。LEAD的建立是為了使Daher先生在數碼圖象與壓縮技術領域的發明面向市場。在過去超過20多年的發展歷程中,LEAD以其在全世界主要國家中占有的市場領導地位,在數碼圖象開發工具領域中已成為既定的全球領導者。LEADTOOLS開發與發布的LEAD是屢獲殊榮的開發工具包。
本文主要介紹通過LEADTOOLS 識別SDK技術,可以解決在表單掃描過程掃描儀可能產生噪音以及其他的問題。
LEADTOOLS中包含表單識別和處理SDK技術的產品有,LEADTOOLS Recognition Imaging Developer Toolkit、LEADTOOLS Document Imaging Developer Toolkit。
處理表格和發票是許多公司日常工作流程的很大一部分。當某人填寫表格副本并將其掃描回公司時,則需要提取該信息。許多OCR引擎都在努力提取此信息,因為表單的掃描分辨率可能比原始表單低,掃描儀可能會產生噪音,或者字段可能是非結構化的且動態生成的。值得慶幸的是,LEADTOOLS Forms Recognition SDK可以解決所有這些問題,并且不需要任何其他手動處理。這些先進的表單識別和OCR庫由LEAD的專利機器學習算法提供支持,可以處理結構化和非結構化表格,可以幫助公司節省寶貴的時間和金錢。
快速準確的表單識別的主要組件來自兩個LEADTOOLS引擎,AutoFormsEngine和和IOcrEngine。AutoFormsEngine提供了高級的表單識別和處理能力,以識別、處理和創建表單,而IOcrEngine是LEADTOOLS提供的所有OCR功能的切入點。
下面的代碼顯示了運行.NET表單識別和OCR應用程序所需的核心。
// Add these global members
static AutoFormsEngine autoEngine;
static RasterCodecs codecs;
static IOcrEngine ocrEngine;
static DiskMasterFormsRepository formsRepository;
// Initialize the Engines
static void InitFormsEngines()
{
codecs = new RasterCodecs();
ocrEngine = OcrEngineManager.CreateEngine(OcrEngineType.LEAD, false);
ocrEngine.Startup(codecs, null, null, @"C:\LEADTOOLS 20\Bin\Common\OcrLEADRuntime");
formsRepository = new DiskMasterFormsRepository(codecs, @"C:\Users\Public\Documents LEADTOOLS Images\Forms\MasterForm Sets\OCR");
autoEngine = new AutoFormsEngine(formsRepository, ocrEngine, null,
AutoFormsRecognitionManager.Default | AutoFormsRecognitionManager.Ocr, 30, 80, true);
}
// Recognize and Process a Form
static void RecognizeAndProcessForm()
{
string resultMessage = "Form not recognized";
string formToRecognize = @"C:\Users\Public\Documents\LEADTOOLS Images\Forms\Forms to be Recognized OCR\W9_OCR_Filled.tif";
AutoFormsRunResult runResult = autoEngine.Run(formToRecognize, null);
if (runResult != null)
{
FormRecognitionResult recognitionResult = runResult.RecognitionResult.Result;
resultMessage = $@"This form has been recognized as a
{runResult.RecognitionResult.MasterForm.Name} with {recognitionResult.Confidence} confidence.";
}
Console.WriteLine("Recognition Results:");
Console.WriteLine("=========================================================================");
ShowProcessedResults(runResult);
}
// Print the output of the results
private static void ShowProcessedResults(AutoFormsRunResult runResult)
{
string resultsMessage = "";
foreach (FormPage formPage in runResult.FormFields)
foreach (FormField field in formPage)
if (field != null)
resultsMessage = $"{resultsMessage}{field.Name} =
{(field.Result as TextFormFieldResult).Text}\n";
Console.WriteLine("Field Processing Results:");
Console.WriteLine(resultsMessage);
}
如果要自己進行測試,請確保從我們網站直接獲得最新的LEADTOOLS SDK安裝包,讓您免費體驗!
相關內容推薦: