OCR图片识别引擎

您所在的位置:网站首页 图片识别引擎网址 OCR图片识别引擎

OCR图片识别引擎

2024-07-13 22:35| 来源: 网络整理| 查看: 265

其中,对于.Net来说三种比较主流和成熟的识别方式:

方式一、Asprise OCR实现。其中需要使用的3个dll是AspriseOCR.dll、DevIL.dll、ILU.dll。其数字识别率比较高,

示例代码:

[DllImport("AspriseOCR.dll")] static extern string craboOCR(string file, int type); private void GetVeryfyCode() { if(File.Exists(_imgPath))//ok { try { this.picbVeryfyCode.Image=System.Drawing.Bitmap.FromFile(_imgPath); _veryfyCode=craboOCR(_imgPath,-1); //将返回string,并以"\r\n"结尾!! _veryfyCode=_veryfyCode.Substring(0,4); this.txtVeryfyCode.Text=_veryfyCode; } catch(Exception e) { this.lblResult.Text+=e.Message; } } }

 

方式二、Microsoft Office Document Imaging(Office 2007) 组件实现。

方式三、Tesseract引擎,其.NET版本地址为:http://www.pixel-technology.com/freeware/tessnet2/。其中在使用前要对该引擎进行安装,安装成功后可以对其Dos命令行进行封装,

调用命令形式如下:

private void UseOCR(string v_strTesseractPath, string v_strSourceImgPath, string v_strOutputPath, string v_strLangPath) { using (Process process = new System.Diagnostics.Process()) { process.StartInfo.FileName = v_strTesseractPath; process.StartInfo.Arguments = v_strSourceImgPath + " " + v_strOutputPath + " -l " + v_strLangPath; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNoWindow = true; process.StartInfo.RedirectStandardOutput = true; process.Start(); process.WaitForExit(); } }

 

 

 



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3