上一篇介绍了Tesseract库的使用(OCR库Tesseract初探),文末提到了Tesseract是用c/c++开发的,也有C#的开源版本,本篇介绍一下如何使用C#版的Tesseract。
C#版本源码下载地址:https://github.com/charlesw/tesseract
其实在vs中可以直接用NuGet工具进行下载:
打开nuget,搜索tesseract,点安装即可。
源码是vs2015编译的,需要安装vs2015以上版本。
打开项目后如:
我们再添加一个winform项目,画界面如:
实现点击“选择需要识别的图片”,打开一张图片,调用算法并显示结果。比较简单。源码如下:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using Tesseract;